Lua · Variables · Core
util and print
Console output, the clock and random numbers.
print writes to the console on the Lua page. Each line is tagged with the script's name and also shows on that script's own console.
| Function | What it does |
|---|---|
print(...) | Writes all arguments to the console, separated by two spaces. Tables print as their address; use json.encode to see what is inside. |
util.print(...) | Same as print. |
util.time() | Seconds since the program started, with decimals. Use it for timers and animation. |
util.random(a, b) | A random whole number from a to b, both included. The order does not matter. |
print(...)Writes all arguments to the console, separated by two spaces. Tables print as their address; use json.encode to see what is inside.
Arguments
...anyValues to print.
Example
print("hp", p.health, p.name)
print(json.encode(bomb.state()))#util.print
util.print(...)Same as print.
#util.time
util.time()Seconds since the program started, with decimals. Use it for timers and animation.
Returns
number
Seconds.
Example
local started = util.time()
if util.time() - started > 3 then hide() end#util.random
util.random(a, b)A random whole number from a to b, both included. The order does not matter.
Arguments
aintegerLowest value.
bintegerHighest value.
Returns
integer
The random number.
Example
local roll = util.random(1, 6)