lua-users home
lua-l archive

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

On 15 August 2011 15:25, Igor Medeiros <> wrote:
> There is a library that provides a sleep function in milliseconds? I tried
> using the posix.sleep() function but it only wait seconds instead
> miliseconds.

You could use `socket.sleep(time)` from the luasocket library [1]. The
parameter `time` is in seconds, but it has millisecond precision, i.e.
to sleep 1 millisecond, call:


It works also on Windows, but it uses the Sleep function from Windows
API [2], which is not precise down to 1 millisecond (AFAIK the minimum
it sleeps is ~15ms [3]).