[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: a new proposal for environments
- From: David Manura <dm.lua@...>
- Date: Thu, 25 Feb 2010 18:46:16 -0500
On Thu, Feb 25, 2010 at 3:52 PM, Roberto Ierusalimschy wrote:
> loadin(env, io.lines(filename))
> (except that this does not work, because 'io.lines' cut the newlines
> from the file; we intend to fix that somehow...)
I once had to reimplement io.lines to include the line ending chars
('\r' and/or '\n'). [1] This was for a patch tool that needed to
detect when different style line endings were fed to it, where the
file is opened in binary mode.
io.lines has similarities to string.split [2], particularly when
expressed in iterator form, and that in turn may complement
string.gmatch [3].
[1] http://lua-users.org/wiki/EnhancedFileLines
[2] http://lua-users.org/lists/lua-l/2006-12/msg00414.html
[3] http://lua-users.org/lists/lua-l/2010-01/msg01247.html
- References:
- Re: a new proposal for environments, David Kastrup
- Re: a new proposal for environments, Duncan Cross
- Re: a new proposal for environments, Jonathan Castello
- Re: a new proposal for environments, Pierre-Yves Gérardy
- Re: a new proposal for environments, Jonathan Castello
- Re: a new proposal for environments, Roberto Ierusalimschy
- Re: a new proposal for environments, Jonathan Castello
- Re: a new proposal for environments, Roberto Ierusalimschy
- Re: a new proposal for environments, Duncan Cross
- Re: a new proposal for environments, Roberto Ierusalimschy