Read Certain File Areas?
SNWLeader 26 Jan 2013
I know that they have the fs.open("string", "read or write")
but is there a way to make it read only a certain part of the file?
but is there a way to make it read only a certain part of the file?
grand_mind1 26 Jan 2013
Why would you need this? Reading the entire file seems pretty good to me.
theoriginalbit 26 Jan 2013
If you mean say extracting a particular line then you could do something like this
Edited by TheOriginalBIT, 26 January 2013 - 04:08 PM.
local function readLine( path, lineNum ) local handle = fs.open( path, "r" ) local line for i = 1, lineNum do line = handle.readLine() end handle.close() return line endobviously this could be modified to ignore particular lines too. or you could modify it to read a subset of lines, but they would need to go into a table.
Edited by TheOriginalBIT, 26 January 2013 - 04:08 PM.
crazyguymgd 26 Jan 2013
TheOriginalBIT, on 26 January 2013 - 03:12 PM, said:
If you mean say extracting a particular line then you could do something like this
local function readLine( path, line ) local handle = fs.open( path, "r" ) local line for i = 1, line do line = handle.readLine() end handle.close() return line endobviously this could be modified to ignore particular lines too. or you could modify it to read a subset of lines, but they would need to go into a table.
Although I would probably use two unique variable names instead of line twice