Posted 27 September 2012 - 05:14 AM
here is the code
here is the error
rednet.open("top")
if not fs.exists("banned") then
local file=io.open("banned", "w")
file:write("")
file:close()
end
function getCodes()
local file=io.open("banned", "r")
local sCodes=file:read()
file:close()
tCodes=textutils.unserialize(sCodes)
end
function addBan(ban)
getCodes()
table.insert("tCodes", ban) -- this is line 17
local sCodes=textutils.serialize(tCodes)
local file=io.open(banned, "w")
file:write(sCodes)
file:close()
end
function checkBanned(Idnum)
local file = io.open("banned", "r")
local sCodes = file:read()
file:close()
tCodes=textutils.unserialize(sCodes)
l=#tCodes
for i=1, l do
if tCodes[l] then
return "true"
end
end
end
while true do
addBan("15")
print("ID | Distance | Message")
Id,Msg,Dis=rednet.receive(timeout)
if not checkBanned(Id) == "true" then
print(Id.." | "..Dis.." | "..Msg)
Id2,Msg2,Dis2=rednet.receive(timeout)
print(Id2.." | "..Dis2.." | "..Msg2)
if Id1==Id2 then
Id3,Msg3,Dis3=rednet.receive(timeout)
print(Id3.." | "..Dis3.." | "..Msg3)
if Id2==Id3 then
Id4,Msg4,Dis4=rednet.receive(timeout)
print(Id4.." | "..Dis4.." | "..Msg4)
addBan(Id4)
print("ID: "..Id4.." Has been BANNED!")
end
end
end
end
here is the error
Request:17: bad argument: table expected, got nil