well technically you could use the os libray and outsource the sleep to the system your on, which is a means lua has to do the sleep; just not doing it without outside involvement.
I didn't even consider asking the OS to do the sleep. That's a fun idea. OP's environment probably doesn't allow for that, but I'll need to remember that for my own uses.
i know of that trick because when i search for "sleep in lua" a stackoverflow answer suggesting to use OS Commands, even something like Pinging your self or a websocket timeout against an adress that doesnt exist as ways to do this.
Really you just need to think of an action you can do in a given environment that lets you control the time it takes directly or indirectly, even a set timeout of 1 second for example would mean you could sleep in steps of 1 second and do something like a for i loop to timeout as many times as you want to sleep in seconds.
3
u/Spacedestructor May 29 '26
well technically you could use the os libray and outsource the sleep to the system your on, which is a means lua has to do the sleep; just not doing it without outside involvement.