Posted 13 June 2014 - 12:55 AM
Now, this one's bugging me; in a loop, I'm trying to have a program read lines from a file and insert them into a table. However, the program fails with the error "attempt to index ? (a nil value)". Here's the code:
if message == "GET_ACCESS_LIST" and protocol == "doorsec" then
local senderDirectory = fs.combine("PRIME/DOORSEC/SERVER", tostring(sender))
local senderRead = fs.open(senderDirectory, "r")
local currentText = "0"
repeat --Repeatedly get access IDs
--local senderRead = fs.open(senderDirectory, "r")
currentText = senderRead.readLine() --Line where the error seems to be
--senderRead.close()
if not currentText == nil then
table.insert(accessLst, currentText)
end
until currentText == nil
rednet.send(sender, textutils.serialize(accessLst), doorsec)
end
I haven't tried rebooting the game, but this isn't the only time I've seen this. Are there any solutions to this problem?Edited on 12 June 2014 - 10:56 PM