Jump to content

guiGetText, check if empty


Forrest

Recommended Posts

I'm working on my own handling editor at the moment as a small project, and I'm currently setting up the limits. I'm probably just being stupid here, but whenever the GUI edit is empty, I get debug errors of trying to compare a number with nil, on line 4, which makes sense. However how do I check whether the edit is empty and not to run the check?

function checkValues() 
    for k, v in pairs(handlingValues) do 
        if name == tostring(v[1]) then 
            if tonumber(guiGetText(source)) > v[2] and tonumber(guiGetText(source)) < v[3] then 
                guiSetEnabled(finishEdit, true) 
            else 
                guiSetEnabled(finishEdit, false) 
            end 
        end 
    end 
end 

Thanks.

Link to comment
  
function checkValues() 
    for k, v in pairs(handlingValues) do 
        if name == tostring(v[1]) then 
            if tonumber(guiGetText(source)) > 0 or tonumber(guiGetText(source)) < 3 then 
                guiSetEnabled(finishEdit, true) 
            else 
                guiSetEnabled(finishEdit, false) 
            end 
        end 
    end 
end 
  

Dint tested it.

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