Schedules a repeating task that runs every specified number of server ticks.
| Name | Type | Description |
|---|---|---|
ticks | integer | Period in ticks. Values below 1 are clamped to 1 tick; 20 ticks is approximately 1 second. |
handler | function | Called as function(task). |
A task handle.
local task = every(20, function(task)
log("tick " .. server.ticks())
end)
-- Later: task:cancel()
every(1, ...). It runs every game tick on the server thread. The task handle's cancel() method stops the repeating task.