lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Wed, 2009-05-20 at 17:57 -0400, Aaron Brown wrote:
> If you're on a unix or another system that has a sleep command callable
> from a shell, you can do:
>   os.execute("sleep 5")

If your code is very tight you can have problem canceling your script:
the ctr-c must catch your code and not the sleep. Otherwise you just
cancel the waiting and "do stuff" again. What i do is:

if os.execute("sleep 5") ~= 0 then return end

(or break if in a loop, etc.). This way, if you press ctrl-c while in
sleep, you'll cancel the script also.