Schedule a function to be called once in the future. Returns immediately.
timer.set(5000, function()
print('Ding!')
end)
print('Waiting 5 seconds...')
loop.run()
print('The timer dinged.')
Schedule a function to be called every timeout
milliseconds. Returns
immediately.
timer.every(1000, function(t)
print('Tick...')
if we_are_done then
t:stop()
end
end)
loop.run()
Yield the current coroutine for timeout
milliseconds.
print('Going to sleep...')
timer.sleep(5000)
print('Woke up')