Skip to content

sdk.schedule

Timers on game.on("tick"). after / every are non-blocking. wait(ms) yields only when the caller is a coroutine.

lua
local M = require("sdk.schedule")

now

function · now(): number

Monotonic timer service. Times are steady-clock milliseconds, not Unix time.

Returns

TypeSummary
number

pump

function · pump(now)

Fire due timers. The host tick already calls this.

after

function · after(delay_ms: number, callback: fun()): TimerId?, ErrorMessage?

Delay is clamped to at least 0 ms.

Parameters

NameTypeSummary
delay_msnumber
callbackfun()

Returns

TypeSummary
TimerId?, ErrorMessage?

every

function · every(interval_ms: number, callback: fun()): TimerId?, ErrorMessage?

Interval is clamped to at least 1 ms.

Parameters

NameTypeSummary
interval_msnumber
callbackfun()

Returns

TypeSummary
TimerId?, ErrorMessage?

cancel

function · cancel(id: TimerId): Result?, ErrorMessage?

Monotonic timer service. Times are steady-clock milliseconds, not Unix time.

Parameters

NameTypeSummary
idTimerId

Returns

TypeSummary
Result?, ErrorMessage?

reset

function · reset()

Monotonic timer service. Times are steady-clock milliseconds, not Unix time.

wait

function · wait(ms)

Suspend the current coroutine for at least ms without blocking the game thread. Calling this from a normal top-level script is an API error; use after there.

Parameters

NameTypeSummary
msnumber

Returns

TypeSummary
boolean|nilok
string|nilerr

Arcane SDK catalog generated from scripts/sdk