UnchiuDawg Posted April 19, 2017 Share Posted April 19, 2017 (edited) I'm trying to make my login panel not allow usernames that contain specific words to register. I want to use a table since there are many words that I want to be restricted (like swear words), but I don't know how I could do this. restrictedusernamewords = {"badword1", "badword2", "badword3"} for k,v in ipairs(restrictedusernamewords) do if string.match(usernameregister, v) then outputChatBox ( "Please don't include vulgar words in your username!", client ) else register the account Right now if the username doesn't contain all the words in the table, it will output the chat message and still register the account. I searched and couldn't find anybody using string.match or string.find with a table like this, am I trying to do this the wrong way? Edited April 19, 2017 by UnchiuDawg Link to comment
NeXuS™ Posted April 19, 2017 Share Posted April 19, 2017 local foundRestricted = false for k,v in ipairs(restrictedusernamewords) do if string.match(usernameregister, v) then outputChatBox ( "Please don't include vulgar words in your username!", client ) foundRestricted = true break end end if not foundRestricted then -- Do register end 1 Link to comment
UnchiuDawg Posted April 19, 2017 Author Share Posted April 19, 2017 Thank you very much. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now