Posted 22 November 2012 - 03:56 AM
Hi :(/>/>
Error : startup:32: bad argument: table expected, got number
Code : The most Code is from your Wiki because i am new in Lua .
Another Question is there away that a user can register on server from an other computer ?
I hope you can help my ,
thanks Fabi =) !
Error : startup:32: bad argument: table expected, got number
Code : The most Code is from your Wiki because i am new in Lua .
print("Attention ! This is a Server no User Pc !") -- this is from the computercraft wiki :(/>/>/>
sleep(3)
print(" ")
os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
print("This is a password server. There is no user interaction here.")
print("Please find a computer and login there.")
local firstCycle = true
local validSender = false
local modemSide = "left"
local valid = false
users = {"menof36go", "user2", "user3", "user4", "user5", "user6", "user7", "user8", "user9" }
passwords = {"0815", "password2", "password3", "password4", "password5", "password6", "password7", "password8", "password9" }
senders = { 1, 2, 3, 4 }
function bootUp()
rednet.open("back")
rednet.open("left")
rednet.open("right")
end
while true do
validSender = false
if firstCycle then
bootUp()
firstCycle = false
end
senderId, message, distance = rednet.receive()
for i,v in ipairs(senders) do
if v == senderId then -- it said startup:32: bad argument: table expected, got number...
validSender = true
break
end
end
if validSender then
for i,v in ipairs(users) do
if message == v then
valid = true
password = passwords[i] -- why theres a [i] ?
break
else
valid = false
end
end
if valid then
rednet.send(senderId, password, true)
else
rednet.send(senderId, "Not Valid", true)
end
end
end
Another Question is there away that a user can register on server from an other computer ?
I hope you can help my ,
thanks Fabi =) !