[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANNOUNCE] Lua 5.0 (work0)
- From: Peter Shook <pshook@...>
- Date: Tue, 11 Jun 2002 23:30:06 -0400
I like the new nexti function and the stateful for loops, but is there a
simpler way than this to read the lines from a file:
local f = io.open(file,'r')
for line in function() return f:read() end do
print(line)
end
f:close()
If I use "for line in f.read, f do print(line) end", then the call to read
gets the variable 'line' passed to it and it complains.
just curious,
- Peter