Jump to content

[Help]Check the value


Hassam

Recommended Posts

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
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

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

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...