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 / boolctxReturns thread instance on successful execution, or false on failure

Callback

exec(self)
TypeNameDescription
threadselfRunning thread instance

Examples

local self = thread:create(function(self)
    engine.print("Hello from thread")
end)

self:resume()

On this page