Thread
thread:create
Shared
Creates a new thread context
Syntax
local ctx = thread:create(exec)Parameters
| Type | Name | Description |
|---|---|---|
function | exec | Function to be executed by the thread |
Returns
| Type | Name | Description |
|---|---|---|
thread / bool | ctx | Returns thread instance on successful execution, or false on failure |
Callback
exec(self)| Type | Name | Description |
|---|---|---|
thread | self | Running thread instance |
Examples
local self = thread:create(function(self)
engine.print("Hello from thread")
end)
self:resume()