Posted 20 August 2014 - 02:57 PM
I've got a program, which you can register for, and I want a limit of 15 to be in the username, but I'm not sure how to make a limit of the number or characters in a string, I've tried searching, but haven't found anything
Here is my register function
Here is my register function
function register()
nSelect = 1
clear()
border()
term.setCursorPos(2,18)
print("Version: "..version)
term.setCursorPos(1,3)
cPrint("Please Register")
cPrint("")
cWrite("Username: ")
print("")
cWrite("Password: ")
print("")
cWrite("Confirm Password: ")
term.setCursorPos(26,5)
user = read()
term.setCursorPos(26,6)
pass = read("*")
term.setCursorPos(30,7)
confirm = read("*")
cPrint("")
-- Make Account
if fs.exists("/.slots/users/"..user.."/password") then
cPrint("Account already created")
sleep(2)
else
if pass == confirm then
fs.makeDir(".slots/users/"..user)
makeAccount = fs.open("/.slots/users/"..user.."/password", "w")
makeAccount.write(pass)
makeAccount.close()
cPrint("Account created")
freeSpins = 5
sleep(2)
spinLoop()
else
cPrint("Passwords do not match")
sleep(2)
end
end
end