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:sleep call and has not yet woken up.
  • Awaiting — the thread is currently suspended inside a self:await call waiting for a promise to settle.

Parameters

No parameters are accepted by this function

Returns

TypeNameDescription
boolstatustrue on successful execution, false otherwise

Examples

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

entity:resume()
Attempt to resume a sleeping thread
local entity = util.thread.create(function(self)
    self:sleep(5000)
end)

entity:resume()
core.engine.print("info", entity:resume()) -- false

On this page