timer
Schedules functions on the game loop.
Source: src/Moongate.Scripting/Modules/TimerModule.cs
Functions
Section titled “Functions”timer.after(seconds, fn) -> stringRuns fn once after the given seconds, which must be positive. Returns a handle for cancel.
| Parameter | Type | Default |
|---|---|---|
seconds | number | |
fn | function |
Returns string.
cancel
Section titled “cancel”timer.cancel(handle) -> booleanCancels a timer by handle. Returns false when no such timer is pending.
| Parameter | Type | Default |
|---|---|---|
handle | string |
Returns boolean.
timer.every(seconds, fn) -> stringRuns fn every given seconds, a positive interval, until cancelled. Returns a handle for cancel.
A repeating timer whose function waits, cancelled by a one-shot timer:
local pulse = timer.every(30, function() log.info("Pulse") wait(2) log.info("Pulse resumed")end)
timer.after(95, function() log.info("Pulse cancelled: {Cancelled}", timer.cancel(pulse))end)| Parameter | Type | Default |
|---|---|---|
seconds | number | |
fn | function |
Returns string.
Made with ❤️ by Tom
