Yuari
Documentation
Docs/task library/task.spawn

task.spawn

Runs fn on a new thread immediately.

Syntax

task.spawn(fn: function) -> nil

Parameters

ParameterTypeDescription
fnfunctionThe function or callback to use.

Returns

TypeDescription
nilThis function does not return a value.

Description

task.spawn is part of the task library library. The task library runs on the VM's own scheduler; waits and delayed callbacks resume when the VM next ticks.

The operation is performed immediately using the arguments supplied at the call site.

Example

task.spawn(function()
    print("spawned")
end)

Notes

  • Waits and delayed callbacks resume on the VM's scheduler.