Posted 28 June 2013 - 06:32 AM
I need help I have several scripts saying the same thing
login:10: attempt to index ? (a nil value)
how can I get this fixed
term.setCursorPos(20,3)
print("Login System")
term.setCursorPos(1,6)
term.setCursorPos(10,8)
print("Name: ")
term.setCursorPos(10,10)
print("Password: ")
term.setCursorPos(20,8)
name = read()
term.setCursorPos(20,10)
pass = read()
login = ""
dbp = io.open("DB/DBlog/" ..name)
if dbp
then
corpass = dbp:read()
dbp:close()
if pass == corpass
then
login = "good"
end
end
sleep(1)
term.clear()
term.setCursorPos(20,3)
print("Login System")
term.setCursorPos(1,6)
if login == "good"
then
print("login accepted" )
end
if login == "good"
then
DBcn = io.open("DB/DBcur/name", "w")
DBcn:write(name)
DBcn:close()
DBl = io.open("DB/DBlvl/"..name, "r")
lvl = DBl:read()
DBl:close()
DBcl = io.open("DB/DBcur/level", "w")
DBcl:write(lvl)
DBcl:close()
end
sleep(1)
Create:28: attempt to index ? (a nil value)
term.setCursorPos(18,3)
print("Account Creation")
term.setCursorPos(10,8)
write("Name: ")
term.setCursorPos(10,10)
write("Password: ")
term.setCursorPos(20,8)
name = read()
term.setCursorPos(20,10)
pass = read()
term.setCursorPos(5,12)
dbp = io.open("DB/DBlog/"..name, "r")
if dbp
then
dbp:close()
print("Username already exists")
sleep(1)
term.setCursorPos(5,13)
print("Shutting down now")
sleep(1.5)
os.shutdown()
else
dbp = io.open("DB/DBlog/"..name, "w")
dbp:write(pass)
dbp: close()
dbl = io.open("DB/DBlvl/"..name, "w")
dbl:write("1")
dbl:close()
print("New account created")
sleep(1)
term.setCursorPos(5,13)
print("ending session")
sleep(1.5)
os.shutdown()
end
any help is appreciated
login:10: attempt to index ? (a nil value)
how can I get this fixed
Spoiler
term.clear()term.setCursorPos(20,3)
print("Login System")
term.setCursorPos(1,6)
term.setCursorPos(10,8)
print("Name: ")
term.setCursorPos(10,10)
print("Password: ")
term.setCursorPos(20,8)
name = read()
term.setCursorPos(20,10)
pass = read()
login = ""
dbp = io.open("DB/DBlog/" ..name)
if dbp
then
corpass = dbp:read()
dbp:close()
if pass == corpass
then
login = "good"
end
end
sleep(1)
term.clear()
term.setCursorPos(20,3)
print("Login System")
term.setCursorPos(1,6)
if login == "good"
then
print("login accepted" )
end
if login == "good"
then
DBcn = io.open("DB/DBcur/name", "w")
DBcn:write(name)
DBcn:close()
DBl = io.open("DB/DBlvl/"..name, "r")
lvl = DBl:read()
DBl:close()
DBcl = io.open("DB/DBcur/level", "w")
DBcl:write(lvl)
DBcl:close()
end
sleep(1)
Create:28: attempt to index ? (a nil value)
Spoiler
term.clear()term.setCursorPos(18,3)
print("Account Creation")
term.setCursorPos(10,8)
write("Name: ")
term.setCursorPos(10,10)
write("Password: ")
term.setCursorPos(20,8)
name = read()
term.setCursorPos(20,10)
pass = read()
term.setCursorPos(5,12)
dbp = io.open("DB/DBlog/"..name, "r")
if dbp
then
dbp:close()
print("Username already exists")
sleep(1)
term.setCursorPos(5,13)
print("Shutting down now")
sleep(1.5)
os.shutdown()
else
dbp = io.open("DB/DBlog/"..name, "w")
dbp:write(pass)
dbp: close()
dbl = io.open("DB/DBlvl/"..name, "w")
dbl:write("1")
dbl:close()
print("New account created")
sleep(1)
term.setCursorPos(5,13)
print("ending session")
sleep(1.5)
os.shutdown()
end
any help is appreciated