lua-users home
lua-l archive

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


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