Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Prompts user for a password
- function getPass()
- print("Password:")
- local password = read()
- return password
- end
- -- Prompts user for a username
- function getUser()
- print("Username:")
- local username = read()
- return username
- end
- -- Performs a linear search on an array
- function linearSearch(key, arr)
- local isFound = false
- local itemIndex = -1
- for i=0,table.getn(arr) do
- if arr[i] == key then
- isFound = true
- itemIndex = i
- end
- end
- return {isValid,itemIndex}
- end
- function validate(table, *input)
- local isValid = false
- local valTable = {}
- if table.getn(table) == table.getn(input)
- --WIP
- valTable[#valTable+1] = linearSearch(input[k], table[i][j])
- end
- end
- -- initilizer method
- function main()
- local username = ""
- local password = ""
- username = getUser()
- password = getPass()
- userTable = {"root","bob"}
- passTable = {"password","cookie"}
- userpassTable = {userTable,passTable}
- print(validateUserpass(userpassTable,username,password))
- --password = getPassword()
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement