lua-users home
lua-l archive

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


since lua doesn't have refcounting and some ppl wanna do basically io.open(file):read("*a") I wanna propose io.lines("filename", "*a")() (or alternatively io.lines("filename", "*a", "*l")) should close the file as if the iterator ran out.


in other words if the first value isn't nil then check if the last value is nil or the last argument is "*a" and if it is then close the file.