Search the docs

Find a guide, global, type or member

GlobalEmber

task

Coroutine scheduling, 20 ticks a second. At most 2048 tasks may be pending; scheduling past that raises.

Functions

task.spawn(fn: (A...) -> (), A...: any)#

Runs fn with the arguments now, as a task that may task.wait.

task.defer(fn: (A...) -> (), A...: any)#

Runs fn as a task soon after the current code finishes, within a tick.

task.delay(seconds: number, fn: (A...) -> (), A...: any)#

Runs fn as a task after seconds, rounded up to whole ticks.

task.wait(seconds: number?) -> number#

Pauses the current task for seconds (at least one tick) and returns the seconds actually waited. Only works inside a task (spawn, defer, delay); raises elsewhere, such as directly in an event handler.