Posted 23 April 2013 - 12:10 AM
Hi! I'm trying to make a thing for my OS (MackOS) for storing settings specific to the user.
But I get an error: startup:427: Expected string, string
Line 427 is in this ccase line 17.
Code:
What am I doing wrong?
But I get an error: startup:427: Expected string, string
Line 427 is in this ccase line 17.
Code:
function register()
term.clear()
term.setCursorPos(math.floor(w-string.len("New User"))/2, 1)
print("New User")
term.setCursorPos(math.floor(w-string.len("Username:"))/2, 4)
write("Username: ")
usrName = read()
term.setCursorPos(math.floor(w-string.len("Password:"))/2, 6)
write("Password: ")
local pass = read("*")
fs.makeDir("users")
if not fs.exists("users/"..usrName) then
fs.makeDir("users/"..usrName)
local file = fs.open("users/"..usrName.."/usrName", "a")
file.writeLine(pass)
file.close()
local file2 = fs.open("users/"..usrName.."/bg", a)
local bgLine = paintutils.loadImage(".logo")
file2.writeLine(bgLine)
file2.close()
sleep(0.5)
term.clear()
term.setCursorPos(math.floor(w-string.len("Registered:"))/2, 2)
print("Registered!")
sleep(0.5)
term.clear()
drawDesktop2()
elseif fs.exists("users/"..usrName) then
term.clear()
term.setCursorPos(math.floor(w-string.len("Username already in use!"))/2, 2)
print("Username already in use!")
sleep(1)
term.clear()
drawDesktop()
end
end
What am I doing wrong?