Lua Program Delay

The os.clock function returns the number of seconds of CPU time for the program. So the sleep function of yours waits for n seconds, if you need to delay 2 minutes, just call:

sleep(2*60)

Note that there are some better solutions to implement sleep functions other than busy waiting, see Sleep Function for detail.

Leave a Comment