Vital.sandbox
ThreadMethods

self:resume

Shared

Resumes an existing suspended thread


Syntax

local status = self:resume(options = false)

Parameters

TypeNameDescription
tableoptionsOptions containing the following fields:
executions (number) - number of executions per resume
interval (number) - resume interval in milliseconds

Returns

TypeNameDescription
boolstatusReturns true on successful execution, or false on failure

Examples

--Resumes only once
local self = thread:create(function(self)
    for i = 1, 5, 1 do
        engine.print("Thread iteration count", i)
    end
end)

self:resume()
--Automatically resumes once every 1 second
local self = thread:create(function(self)
    for i = 1, 5, 1 do
        thread:pause()
        engine.print("Thread iteration count", i)
    end
end)

self:resume({executions = 1, interval = 1000})

On this page