Async able Countdown
Posted: Wed Jan 12, 2022 4:57 pm
For my current Project i have fiddlet togehter a callable Countdown which can be launched async.
Maybe it is usefull for someone.
Thanks @ShyTwig16 for the idea of a threaded approach
Maybe it is usefull for someone.
Thanks @ShyTwig16 for the idea of a threaded approach
Code: Select all
{$lua}
if syntaxcheck then return end
[ENABLE]
local function asyncTimer(count,text)
local start = os.clock()
local current = 0
while current < count do
current = os.clock() - start
--print(current)
end
speakEnglish(text)
return true
end
function countDown(count,text)
createThread(function(thread)
if asyncTimer(count,text) then
thread.Destroy()
end
end)
end
countDown(30,'expired')
[DISABLE]