lua-users home
lua-l archive

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


On Wed, Jul 28, 2004 at 12:42:59AM +0300, Asko Kauppi wrote:
> 
> Lua 5.0 has:
> 
> ? io.lines ([filename])
> Opens the given file name in read mode and returns an iterator function 
> that, each time it is called, returns a new line from the file. 
> Therefore, the construction for line in io.lines(filename) do ... end 
> will iterate over all lines of the file.
> 
> 
> Would it make sense to have an analogous 'string.lines ([str])' 
> constructor, allowing a string of multiline text to be easily iterated 
> linewise?

Won't string.gfind("[^\n]+") do?

-- Jamie Webb