pub fn lines(filename: option<string>, formats: Repeatable<string>) -> functionExpand description
Iterates over the lines of a named file.
§Parameters
filename: the file to open in read mode. When absent, iterates over the default input file.···: read formats, as infile::read(default"l").
§Return value
An iterator function. Unlike file::lines, this form closes the
file automatically when the loop ends, when it fails, or when it is
interrupted by a break inside a generic for.
§Examples
for line in io.lines("notes.txt") do
print(line)
end