Egor_Varaksa Posted January 17, 2022 Share Posted January 17, 2022 (edited) How can I make it so that only English letters and numbers can be entered in the guiCreateEdit field? Edited January 17, 2022 by Egor_Varaksa Link to comment
The_GTA Posted January 17, 2022 Share Posted January 17, 2022 Hello Egor_Varaksa, I suggest you try playing around with the onClientGUIChanged event. Use the guiGetText function to fetch the current content of the editbox. If the current text contains any invalid characters then reset it to the previous text. You should try using the utf8.find function to check for validity of the text. Basically, if the entire content matches against your pattern (start index = 1, end index = #content) then it does match your language requirements. Link to comment
Egor_Varaksa Posted January 18, 2022 Author Share Posted January 18, 2022 Do I need to create a table with forbidden characters? If so, it will take a long time. Is it possible, on the contrary, to create a table with only allowed characters? Link to comment
The_GTA Posted January 18, 2022 Share Posted January 18, 2022 Please take a look at the lua-users.org Patterns tutorial page. If you want to match for only the string of 'abc' characters then you can do... local beg, term = utf8.find("aaaaabbbbbcccc", "[abc]*"); 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