lua-users home
lua-l archive

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


On 23.02.2011 13:48, Gilles Ganault wrote:

> Any idea what could be wrong with the code?

There is nothing wrong with the code. Works for me as expected:

lua myscript.lua < /dev/null

io.read() by default reads whole line ('*l'). So you need to send it a
line (ending with CR/LF, or CTRL+D for empty line), or close the input.
Otherwise it waits in blocking read. You seem to expect it is
non-blocking. Try io.read(0) and read the manual:
http://www.lua.org/manual/5.1/manual.html#pdf-file:read

Regards,
miko