Posted 18 November 2013 - 03:43 PM
Hello there,
I am working on a code that incorporates the Small Net system from Miscperipherals to read the Last line within a file. The problem I am having is I don't know the fucntion or the way to select a line from that file. I tried file.readLine(x) but that doesn't allow you to select the line it just reads the first one.
Thanks,
Vennom.
I am working on a code that incorporates the Small Net system from Miscperipherals to read the Last line within a file. The problem I am having is I don't know the fucntion or the way to select a line from that file. I tried file.readLine(x) but that doesn't allow you to select the line it just reads the first one.
Thanks,
Vennom.
function lineCount()
local file = fs.open("disk/logs", "r")
if file then
local i = 0
while file.readLine() do
i = i + 1
end
file.close()
print(i)
return i
end
end
function finding()
line = lineCount()
print(line.."x")
local file = fs.open("disk/logs","r")
local a = file.readLine(line)
print(a)
return a
end
function transmiting()
local Venn = peripheral.wrap("smNetSender_0")
local Edd = peripheral.wrap("smNetSender_1")
local p = finding()
Venn.send("smartHelemet",p)
Edd.send("smartHelemet",p)
end
while true do
transmiting()
sleep(5)
end