Home / Timers

after()

after(ticks, handler)

Schedules a one-shot timer to execute a function after a delay.

Parameters

NameTypeDescription
ticksnumberDelay in ticks (20 ticks = 1 second).
handlerfunctionCalled as function(task).

Returns

A task handle.

Example

after(100, function(task)
  server.broadcast('Five seconds have passed.')
end)

Notes

Delays below one tick are clamped to one tick. Call task:cancel() on the returned handle to cancel it. Tasks are also removed when their plugin is unloaded.