Vital.sandbox
Thread

thread:create

Shared

Creates a new thread context


Syntax

local ctx = thread:create(exec)

Parameters

TypeNameDescription
functionexecFunction to be executed by the thread

Returns

TypeNameDescription
thread / boolctxthread instance on successful execution, or false on failure

Callback: exec

exec(self)
TypeNameDescription
threadselfRunning thread instance

Examples

Create and resume a basic thread
local self = thread:create(function(self)
    engine.print("info", "Hello from thread")
end)

self:resume()

On this page