lua-users home
lua-l archive

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


With 'file:read’ the description of the “l” (or “*l” in previous
editions) reads:

 - "l": reads the next line skipping the end of line

When testing this on Windows and Mac, it turns out only an LF (char
10) is recognised as a line end.

This means that reading a Windows based text file, with CRLF as
line endings, the returned lines will have a trailing CR (char 13).

My expectations were that it would in all cases treat CRLF and LF
The same way, similar to the way the Lua source code can be read.

Sample code to show the behaviour: 
https://github.com/lunarmodules/luasocket/pull/294#issuecomment-1077264055

Is there a specific reason for this behaviour? Did I misinterpret something?

regards
Thijs