Hassam Posted November 9, 2013 Share Posted November 9, 2013 Hello I have one question How I can check the number from editbox(Min and Max)? Example: If I put number 100001, won't accept, but if I put 100000 will accept (Max) Another Example: If I put number 49999, won't accept, but if I put number 50000 will accept (Min) Link to comment
Tete omar Posted November 9, 2013 Share Posted November 9, 2013 Use: guiEditSetMaxLength Link to comment
Hassam Posted November 9, 2013 Author Share Posted November 9, 2013 Use: guiEditSetMaxLength No, it don't work, I want only when I write $100001, will say is invalid, due is more than $100000 and for min: I'll write 48000 and will say it's invalid due is less than $50000 Link to comment
Tete omar Posted November 9, 2013 Share Posted November 9, 2013 I really did not understand what you mean, can you explain better? Link to comment
Hassam Posted November 9, 2013 Author Share Posted November 9, 2013 I really did not understand what you mean, can you explain better? On edit box; For Max: I'll write "10", but will have one error because the max number is "9", not "10" For Min: I'll write "1", but will have another error because the min. number is "2", not "1" Link to comment
Gallardo9944 Posted November 10, 2013 Share Posted November 10, 2013 What's the problem to check the value? local minLimit = 1000 local maxLimit = 5000 local val = guiGetText(edit) local numval = tonumber(val) if val and tonumber(val) then --checking if the value can be a number if val < minLimit then return false -- Lower. You can output that the lowest value is 1000 elseif val > maxLimit then return false --Higher. You can output that the max value is 5000 else return true --Suitable value. Ouput that it's fine and do your stuff end end 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