TheCyberVerse Posted February 27, 2017 Posted February 27, 2017 I need to get the contents of a file line by line because i am trying to create an open printer program but I'm not sure what to do. I have tried: while not (file:read("*l") == nil) do openprinter.writeln(file:read("*l")) end But the file:read("*l") on the second line returned nil. Any suggestions? Quote
1 Magik6k Posted February 27, 2017 Posted February 27, 2017 Use ``` for line in io.lines("/home/file.txt") do --line is a string end ``` Quote
I need to get the contents of a file line by line because i am trying to create an open printer program but I'm not sure what to do.
I have tried:
But the file:read("*l") on the second line returned nil.
Any suggestions?