lua-users home
lua-l archive

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



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?

-ak