It has not been tested (yet...) so please report bugs here.
function getVersion() --Version of the API
return "v0.01"
end
function makeAdmin(user)
if isAccount(user) == false then return false end
file = fs.open(user.."/.admin", "w")
file:write("true")
file:close()
end
function isAdmin(user)
if isAccount(user) == false then return false end
return fs.exists(user.."/.admin")
end
function isAccount(user) --Returns true if the path given is a account
if fs.exists(user) and fs.isDir(user) then
if fs.exists(user.."/.pass") then
return true
else
return false
end
else
return false
end
end
function newAccount(user, pass) --Creates a account with the specified username and password
if isAccount(user) then
error("Account already exists!")
end
fs.makeDir(user)
file = fs.open(user.."/.pass", "w")
file:write(pass)
file:close()
end
function isPass(user, pass) --Returns true if "pass" == the real password.
if fs.isAccount(user) then
passfile = fs.open(user.."/.pass", "r")
password = passfile:readAll()
passfile:close()
if pass == password then
return true
else
return false
end
else
return false
end
end
function passRead(user) --Creates a read() function that returns true if you entered the correct password
return isPass(user, read("*"))
end
-- ======================= --
-- = EXAMPLE PROGRAM = --
-- ======================= --
--write("Username: ")
--username = read()
--write("Password: ")
--if passRead(username) then
-- print("lol")
--else
-- print("fail")
--end
Most of the information is in the code above.












