time
The clocks a script can read.
time.now and time.dt advance with drawn frames; they do not tick while the overlay is not drawing. For the wall clock use time.wall or os.date.
Reference#
time.now#since 1.0
time.now(): numberSeconds since this script loaded. Use it for animations and timeouts.
| Returns | Description |
|---|---|
number | Seconds. |
local t0 = time.now()
events.on("frame", function()
if time.now() - t0 > 5 then log.info("five seconds") end
end)time.dt#since 1.0
time.dt(): numberSeconds the last frame took. Multiply speeds by it so motion does not depend on the frame rate.
| Returns | Description |
|---|---|
number | Seconds. |
time.frame#since 1.0
time.frame(): integerHow many frames have been drawn since the script loaded.
| Returns | Description |
|---|---|
integer | The frame number. |
time.wall#since 1.0
time.wall(): numberThe current real time. os.date("%H:%M", time.wall()) formats it.
| Returns | Description |
|---|---|
number | Unix time in seconds. |