Posted 02 March 2012 - 11:00 PM
I was just wondering, is there a way to choose specific lines for it to read?
How would i select i line?I'd say: read all and then select a line. Probably simplest way, unless - which i doubt - there is actually a way to do that with io.read().
I don't see how i could use this to read a specific line…There is no file:seek() ect in CC, you can however use file:lines() if you want to read through all the lines of a file much quicker :unsure:/>/>
for line in file:lines() do print(line) end
local tFile = {}
local hHandle = fs.open("file", "r")
repeat
local line = hHandle:readLine()
table.insert(tFile, line)
until not line
hHandle:close()
print(tFile[3]) -- Gets line 3
print(tFile[10]) -- Gets line 10