29.04.2020, 21:35
(25.04.2020, 04:39)AlexLV Wrote: Hi,
here I see different variants, may be you will find something useful for your case:
http://lua-users.org/wiki/SleepFunction
I think this is good for you:
Solution: os.clock()
. .
Using the os.clock() method instead of os.time(), you can get precision down to one 100th of a second while os.time() only allows intervals based on the timestamp, which at execution can be at anything from 0.1 to 1 second. The os.time() method is great for longer periods over 2 seconds where precision isn't that much of a deal.
function sleep(s)
local ntime = os.clock() + s/10
repeat until os.clock() > ntime
end
BR,
Alex
Thanks, i have this working now
function sleep(s)
local ntime = os.clock() + s
repeat until os.clock() > ntime
end