self:resume
Shared
Resumes a suspended thread instance
Syntax
local status = self:resume()A thread cannot be resumed while it is sleeping or awaiting a promise. Both states must be cleared before self:resume can run successfully.
- Sleeping — the thread is currently inside a
self:sleepcall and has not yet woken up. - Awaiting — the thread is currently suspended inside a
self:awaitcall waiting for a promise to settle.
Parameters
| No parameters are accepted by this function |
|---|
Returns
| Type | Name | Description |
|---|---|---|
bool | status | true on successful execution, false otherwise |
Examples
local entity = util.thread.create(function(self)
core.engine.print("info", "Hello from thread")
end)
entity:resume()local entity = util.thread.create(function(self)
self:sleep(5000)
end)
entity:resume()
core.engine.print("info", entity:resume()) -- false