[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: string.lines (a suggestion)
- From: Asko Kauppi <asko.kauppi@...>
- Date: Wed, 28 Jul 2004 00:42:59 +0300
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