Posted 08 September 2012 - 07:48 PM
Hello,
I am trying to make a program that opens a file, reads a line in the file, returns each line as a string, and then adds that string to a table. and returns every line as a seperate string, then saves those values to a table. I do not want to use file.readAll(), because i want each line stored as a seperate value on a table. Any help would be appreciated.
here is what i have so far on my current re-write of this program
I really only need help figuring out how to read the file, the rest I can do myself.
Thanks,
~Matt
I am trying to make a program that opens a file, reads a line in the file, returns each line as a string, and then adds that string to a table. and returns every line as a seperate string, then saves those values to a table. I do not want to use file.readAll(), because i want each line stored as a seperate value on a table. Any help would be appreciated.
here is what i have so far on my current re-write of this program
--Declare Variable
local loc = "/UID"
--declare funtions
function readFile()
if fs.exists(loc) then
local tFile = io.open(loc,"r")
if tFile then
for line in tFile:lines() do
print(tFile.readLine())
end
end
end
end
--Run fucntions
readFile()
I really only need help figuring out how to read the file, the rest I can do myself.
Thanks,
~Matt