lua-users home
lua-l archive

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

I agree.
I have previously suggested that the lines() function has an additional
parameter which is a set of characters that terminate a line and also
returns the character that terminated the line. It is also helpful for
those of us who have to deal with the issues raised by text print
streams and \f. e.g. \r\f \r\n\f \f etc

The issue with sockets is the same as io.lines().

It is not a lot of code to add something like

 string. terminator(s) = read("*l",  "\r\n")

The other reason for making the line terminator visible to the
programmer is that some RFCs specify \013 and \010. I
have used a compiler where \013 is not \r.



On 7/23/07, David Given <> wrote:
> What would be really nice is a way of programmatically telling the socket
> library how to split lines, via, say, a regexp. Unfortunately that would
> probably have a really major performance hit...