Stealthy Serval Posted December 5, 2018 Share Posted December 5, 2018 Hey all, so I'm wanting to look at the string from a characters name and ensure that all characters are A-Z (no numbers or special characters) But unfortunately I can only get it to look at the first character of the string. if not string.find(fName, "^%a") or not string.find(lName,"^%a")then if isTimer(cTimer)then killTimer(cTimer) end guiSetText(createChar.errorLab,"Invalid characters. (A-Z only)") cTimer = setTimer(fadeError,3000,1) return end I've switched between string.find() and string.match() to try them both, and I've also switched the code from if not to if and else, but still not luck. Link to comment
Stealthy Serval Posted December 5, 2018 Author Share Posted December 5, 2018 (edited) I was able to fix this problem by adding "+$" to the end of the string.find() calls. if not string.find(fName, "^%a+$") or not string.find(lName,"^%a+$")then if isTimer(cTimer)then killTimer(cTimer) end guiSetText(createChar.errorLab,"Invalid characters. (A-Z only)") cTimer = setTimer(fadeError,3000,1) return end I'm not sure if this is the most effective way or not, but it fixed it! Edited December 5, 2018 by Stealthy Serval 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