Posted 15 June 2013 - 07:52 AM
I'm currently creating a control network for my RP2 Quarry. This is a program for information exchange between control center and drill.
If I try to edit state or statecontrol right after error, I get same error on edit:51. If I edit file that doesn't exist, I can't save it (Error saving to 123, for example).
Is this a bug in CC 1.5(FTB Ultimate 1.1.2) or in my program?
function checkState ()
local file1 = fs.open("state","r")
return(file1.readLine())
end
function setState (state)
local file = fs.open("state","w")
file.write(state)
file.close()
end
rednet.open("right")
while true do
id, msg = rednet.receive()
if ((id == 8) and (msg ~= "state")) then
setState(msg)
end
if (msg == "state") then
rednet.send(id,checkState())
end
end
On running it I get Attempt to index ? (a nil value) on string 3. This means that file wrapping failed. But state file IS there.If I try to edit state or statecontrol right after error, I get same error on edit:51. If I edit file that doesn't exist, I can't save it (Error saving to 123, for example).
Is this a bug in CC 1.5(FTB Ultimate 1.1.2) or in my program?