bios:206: [string "Server"]:21: '=' expected
Server Code:
local users = { "user1" = "password1", "user2" = "password2" }
local senders = { 4, 5 }
local function clear()
term.clear()
term.setCursorPos(1, 1)
end
local function connect()
for _,s in ipairs(rs.getSides()) do
if peripheral.isPresent(s) and peripheral.getType(s) == "modem" then
rednet.open(s)
return true
end
end
return false
end
local function isValid(sender)
for _,id in ipairs(senders) do
if id == sender then
return true
end
end
return false
end
if not connect() then
print("No modem found")
return
end
clear()
print("This is a password server. There is no user interaction here.")
print("Please find a computer and login there.")
while true do
local id, msg = rednet.receive()
if isValid(id) then
local usr = textutils.unserialize(msg)
if usr then
if users[usr.username] == usr.password then
rednet.send(id, "PASS_OK")
else
rednet.send(id, "PASS_WRONG")
end
end
end
end
P.S. I COPIED DIRECTLY FROM COMPUTERCRAFT SO IT WONT LET ME PUT IT IN A CODE SPOILER THING
Edited by Lyqyd, 30 November 2012 - 02:46 PM.
added code tags.












