I googled and I found this function and it works:
function delay(delay_time)
local time_to = os.time() + delay_time
while os.time() < time_to do end
end
*delay_time is in seconds. 0.6 is 600 miliseconds…
***ORIGINAL MESSAGE
Hi. In my game I need to create a Delay function, because it does not exist in lua natively.
I want this:
code 1
–wait x miliseconds
code 2
I saw timer.performWithDelay but I think it is not what I need because it requires the creation of an extra function and does not hang the code execution…
code 1
* a call to run the extrafunction, x miliseconds in the future
code 3 <-- runs immediately after *
function extrafunction()
code 2
end
So, how can I make that correctly to perform a real delay (like we see in other programming languages) as I need?
Help me please
Thanks!