spawn
Runs fn immediately on a new coroutine. Errors are logged, not propagated.
Syntax
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
spawn is part of the Core functions library. Core globals are installed in every executor thread and drive output, scheduling and identity.
The operation is performed immediately using the arguments supplied at the call site.
Example
spawn(function()
print("running in a new coroutine")
end)
Notes
- Core globals are available in every script.