lua-users home
lua-l archive

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


Now that 5.1 is near enough to finalized, here is my request for
change for 5.11.

A colleague of mine provided me with a modified io.lines (named io.linex)
that is similar to the original but differs as follows:

1) a line is defined as something that is terminated by either "\n" or "\f"
2) leading and trailing "\r" s are removed from the line before it is
returned. This feature may be optionally disabled.
3) The iterator returns 2 values rather than 1. The second value is the
line terminator. e.g. "\n" or "\f"

Other than the changes above this performs the same as io.lines/fh:lines.

I have tested and used this on win32 and linux.

I argue the case for its inclusion in Lua because I find the iterator
invaluable in processing report files from various applications from
OSs. It sanely handles combinations like CRLF, LF, CRFF, FF, CRFFCR
etc., keeps the string processing in C rather than Lua
whilst keeping the lua read loops simple.

David Burgess