lua-users home
lua-l archive

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


On Sep 10, 2011, at 2:05 AM, Mike Panetta wrote:

> Why would anyone expect io.lines to read binary files correctly?  Binary
> files have no concept of a 'line'...

Good point :)

Nonetheless, io.lines does have a concept of lines, it's just that it's stripping the EOL marker by default, which is not necessarily what one might  want when computing a hash or something.

In 5.2, you might want to use the '*L' option, instead of the default '*l' one:

	• "*l": reads the next line skipping the end of line, returning nil on end of file. This is the default format.
	• "*L": reads the next line keeping the end of line (if present), returning nil on end of file.

http://www.lua.org/work/doc/manual.html#pdf-file:read