TheCyberVerse 1 Posted February 27, 2017 Share 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 Link to post Share on other sites
1 Solution Magik6k 17 Posted February 27, 2017 Solution Share Posted February 27, 2017 Use ``` for line in io.lines("/home/file.txt") do --line is a string end ``` Quote Link to post Share on other sites
0 TheCyberVerse 1 Posted February 27, 2017 Author Share Posted February 27, 2017 Thank you! Quote Link to post Share on other sites
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?
Link to post
Share on other sites