Posted 30 January 2014 - 11:25 AM
I want to make a smart login server. If you logged in, it will add you to a table of authenticated ID's. But how do I make the server scan the table for the ID to see if it is authenticated or not?
tId = {
1 = "derp",
2 = "derpy"
}
function check(id)
for i=1,#tId do --the # returns the number of numerical keyes from 1 to the first nil, so here it will return 2
if tId[i] == id then
return true
end
end
if check"derp" then
print"id found!"
end
tId = {
["derp"] = true,
["derpy"] = true
}
function check(id)
return tId[id]
end
if check("derp") then
print("id found!")
end
tId[user] = true