[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Right way to emty stdin?
- From: David Favro <lua@...>
- Date: Wed, 23 Feb 2011 08:34:51 -0500
On 02/23/2011 08:21 AM, Gilles Ganault wrote:
> ... the server does end each line with a CRL/LF, ending with an empty
> CR/LF line when done, so I can't figure out why the while loop never
io.read() will return an empty string when it encounters the blank line
which indicates the end of the variable-list, rather than returning nil,
which occurs when EOF is reached on input (i.e. the pipe from asterisk (AGI)
or socket (FastAGI) is closed). So uncomment your line that tests for
-- if line == "" then break end
You can implement almost any AGI script _without_ using non-blocking or
asynchronous I/O, which I've always found require some C functions rather
than lua's standard I/O library.