wolfhacklua API 1.1 Forum

time

The clocks a script can read.

since 1.0no permission needed

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(): number

Seconds since this script loaded. Use it for animations and timeouts.

ReturnsDescription
numberSeconds.
lua
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(): number

Seconds the last frame took. Multiply speeds by it so motion does not depend on the frame rate.

ReturnsDescription
numberSeconds.

time.frame#since 1.0

time.frame(): integer

How many frames have been drawn since the script loaded.

ReturnsDescription
integerThe frame number.

time.wall#since 1.0

time.wall(): number

The current real time. os.date("%H:%M", time.wall()) formats it.

ReturnsDescription
numberUnix time in seconds.
API 1.1 · source docs-src/api/time.json