Skip to content

task

Properties

The task instance has no set properties!

Methods

The task instance has no set methods!

Functions

cancel

task . cancel (

     thread: thread
)  -> ()

Stops a currently scheduled thread from resuming.

defer

task . defer (

     functionOrThread: thread | (T...) -> ...any
     ...: T...
)  -> ()

Defers a thread or function to run at the end of the current task queue.

delay

task . delay (

     duration: number
     functionOrThread: thread | (T...) -> ...any
     ...: T...
)  -> ()

Delays a thread or function to run after duration seconds.

spawn

task . spawn (

     functionOrThread: thread | (T...) -> ...any
     ...: T...
)  -> ()

Instantly runs a thread or function.

If the spawned task yields, the thread that spawned the task will resume, letting the spawned task run in the background.

wait

task . wait (

     duration: number?
)  -> ()

Waits for at least the given amount of time.

The minimum wait time possible when using task.wait is limited by the underlying OS sleep implementation. For most systems this means task.wait is accurate down to about 5 milliseconds or less.