This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Blocking delay
#2
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
Reply


Messages In This Thread
Blocking delay - by benanderson_475 - 24.04.2020, 22:09
RE: Blocking delay - by AlexLV - 25.04.2020, 04:39
RE: Blocking delay - by benanderson_475 - 29.04.2020, 21:35
RE: Blocking delay - by admin - 25.04.2020, 07:38
RE: Blocking delay - by admin - 30.04.2020, 04:38
RE: Blocking delay - by AlexLV - 30.04.2020, 16:00

Forum Jump: