Task.terminated readonly property
Checks if the Task has terminated its execution, returning true
or false
otherwise.
- "created" : the Task has just been created, and has not started.
- "running" : the Task is currently running.
- "sleeping" : the Task is sleeping (ie has called the global sleep() function).
- "waiting" : the Task is waiting for another Task to terminate.
- "terminated" : the Task has terminated its execution.
Example
local ui = require "ui"
local win = ui.Window("Task.terminated sample", 320, 200)
local pb = ui.Progressbar(win)
pb:center()
local task = async(function()
while pb.position < 100 do
pb:advance(1)
sleep()
end
end)
local uitask = ui.run(win)
while not task.terminated do
win:status("Position = "..pb.position)
sleep()
end