Jump to content

Restrict Input Characters


'LinKin

Recommended Posts

Posted

Hello,

I want to know how can I restrict the characters that a player can type inside an editBox

ABCDEFGHIJKLMNOPQRSTUVWXYZ

and

0123456789

How can I do that?

Thanks

Posted

If you don't want them to type letters or numbers use onClientKey and cancelEvent. Not sure now, if cancelEvent will cancel the event if you are typing, give it a try.

Posted

I extracted this from an old script i made. You might find it helpful.

  
if string.find(guiGetText(source),"%W") then 
    guiSetEnabled(NextStepchoosenameTXT,false) 
    guiStaticImageLoadImage(NextStepchoosename,"pictures/button_disabled.png") 
    guiSetText(errorOutput,"Your first name must not contain non-alphanumeric characters!") 
end 
  

http://www.lua.org/pil/20.2.html - patterns are explained here

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...