Task:pause()method
Suspend the Task execution until the Task is resumed with Task:resume().
Return value
This method returns no value.
Example
local t = sys.Task(function()
for i = 1, 10 do
print(("task: step %d"):format(i))
sleep(500) -- yield to scheduler
end
print("task: completed")
end)
t() -- start task
sleep(1200) -- let task run a couple of steps
print("main: pausing task")
t:pause() -- pause the task
print("main: task paused, sleeping 2000ms")
sleep(2000) -- task remains paused during this time
print("main: resuming task")
t:resume() -- resume the task
await nt -- wait for completion
print("main: task.status =", t.status)