Secret Santa 2024
Prev Previous Post   Next Post Next
Original Post
[HELP]Seconds delay?
function delay_s(delay)
	delay = delay or 1
	time_to = os.time + delay
	while os.time() < time_to do end
end

echo("hello.")
delay_s(5)
echo("goodbye. Well, if the damn delay worked.")
As you can see, the function delay_s takes a number and assigns it to the variable delay, or if you don't give the function a number it will assign it 1 by default. Then the variable time_to gets the time and adds the delay to it, and then waits till it reaches that time.

After returning a "hello", it fails to execute the delay function. The same script works outside of toribash, if you change "echo" to "print".

Is there another way to do this?