Advertisement
Guest User

Lua - check login

a guest
Jun 17th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.58 KB | None | 0 0
  1. local function inLogin(login, nick)
  2.     local check_login = 0
  3.     for _, v in ipairs(login) do
  4.         if v == nick then
  5.             check_login = check_login + 1
  6.         end
  7.     end
  8.     if check_login > 0 then
  9.         return true
  10.     else
  11.         return false
  12.     end
  13. end
  14.  
  15.  
  16. --------------------------------------------
  17. local login ={"teste", "teste2"}
  18.  
  19.  
  20. print(inLogin(login, 'teste'))
  21. print(inLogin(login, 'outro_login'))
  22.  
  23. if inLogin(login, "teste") then
  24.     print("Login Valido")
  25. else
  26.     print("Login Invalido")
  27. end
  28.  
  29.  
  30. if inLogin(login, "outro_login") then
  31.     print("Login Valido")
  32. else
  33.     print("Login Invalido")
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement