task

Show Deprecated

The task library allows for functions and threads to be scheduled with the engine's scheduler.

The functions available in this library generally support functions and threads. In most cases using a function is sufficient, but for more advanced cases it's recommended you familiarize yourself with the coroutine library.

Summary

Functions

  • spawn(functionOrThread : function | coroutine,... : Variant):coroutine

    Calls/resumes a function/coroutine immediately through the engine's scheduler.

  • defer(functionOrThread : function | coroutine,... : Variant):coroutine

    Calls/resumes a function/coroutine at the end of the current resumption cycle.

  • delay(duration : number,functionOrThread : function | coroutine,... : Variant):coroutine

    Schedules a function/coroutine to be called/resumed on the next Heartbeat after the given duration (in seconds) has passed, without throttling.

  • Causes the following code to be run in parallel.

  • Causes the following code to be run in serial.

  • wait(duration : number):number

    Yields the current thread without throttling.

  • cancel(thread : coroutine):()

    Cancels a thread, preventing it from being resumed.

Functions

Parameters

functionOrThread: function | coroutine
...: Variant

Returns

Parameters

functionOrThread: function | coroutine
...: Variant

Returns

Parameters

duration: number
functionOrThread: function | coroutine
...: Variant

Returns

desynchronize

()

Returns

()

synchronize

()

Returns

()

wait

Parameters

duration: number
Default Value: 0

Returns

cancel

()

Parameters

thread: coroutine

Returns

()