Jump to content

[SOLVED] Check string's length


Rudy

Recommended Posts

Posted (edited)

Hey guys,

What's the problem with this?

if string.len(guiGetText(varible)) == 0 then 
    --something 
end 

I think nothing, but it isn't works. I tested the guiGetText function with this varible, and it's works. Zero errors printed to my server's log.

Thanks,

Rudy

Edited by Guest
Posted
I tested the guiGetText function with this varible, and it's works. Zero errors.

It isn't that important, because this is only a comfort function - but it'd be good if somebody write down what is the problem. Lines before and after this code are work too.

Posted

And you're sure the string is completely empty? Is the GUI element properly created? If that if statement fails to run it could mean that guiGetText returns false - or nil. But if that was the case, it should output it in the debug. Make sure you check the debug for any errors.

Posted

Yes, If it's empty returns false. I tested it first. And I write down again: errors do NOT exist. But I reinstalled all MTA server files, and the problem's solved.

Posted
Yes, If it's empty returns false. I tested it first. And I write down again: errors do NOT exist. But I reinstalled all MTA server files, and the problem's solved.

If the string is empty it should return 0 as far as I'm aware, and not false. It would only return false if the GUI element does not exist or it received something other than a string.

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