lua-users home
lua-l archive

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


On 11 October 2011 11:07, HyperHacker <hyperhacker@gmail.com> wrote:

> Hmm, according to the manual, receive() should return the partial
> result after the error message, but I'm getting inconsistent results.
> If I use *l, it always returns the full result, but *l strips the line
> break character, so I can't tell if the line has actually ended

If the line did actually end then it'll be the first result from
receive().  If a timeout occured then the results will be nil,
"timeout" and then the partial line.

Sean Connor pointed out that repeated calls with a zero timeout will
burn performance.  Perhaps you could use a timeout that starts off as
the maximum reasonable request time, and gradually decreases after
each successful call.