Guest User

Untitled

a guest
May 23rd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | None | 0 0
  1. function loadUserFile()
  2.     User = {} -- Not sure if you define that anywhere else.
  3.     local i = 1
  4.     print("Checking  "..sPasswdPath.." exists...")
  5.     if fs.exists(sPasswdPath) then
  6.         file = io.open(sPasswdPath, "r")
  7.         print ("Loading file....")
  8.         while true do
  9.         User[i] = file:read()
  10.         if User[i] == nil then i = i - 1 break end
  11.         print ("User "..i..":  "..User[i])
  12.         i = i + 1
  13.         end
  14.     else
  15.     print "Error: Password file doesn't exist."
  16.     end
  17. return i -- returns the last user that was valid and printed
  18. end
Add Comment
Please, Sign In to add comment