task.spawn
Runs fn on a new thread immediately.
Syntax
task.spawn(fn: function) -> nil
Parameters
| Parameter | Type | Description |
|---|---|---|
fn | function | The function or callback to use. |
Returns
| Type | Description |
|---|---|
nil | This 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.