lua-users home
lua-l archive

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


On Sat, Feb 22, 2014 at 4:30 PM, Andrew Starks <andrew.starks@trms.com> wrote:
> I don't want to be the guy that advocates for banning dogs, though. It just
> seems that "lines" doesn't deserve the elevated status it enjoys, when a
> simple and more general alternative could serve as well and be more robust.

But it's a straightforward API, and it works well  - assuming you have
trusted, non-garbled and non-pathological ASCII text files.  When I
write text-wrangling scripts, practically the first thing I write is
'for line in io.lines(f)...'.   So I'm particularly fond of this dog.

I see the extension for those cases where you need to be paranoid, and
to deal with odd files which contain nuls and yet are sufficiently
structured that '\n' actually is a delimiter.  Because naturally
applying even the most intelligent readline() to an arbitrary file
will give arbitrary results.