Jump to content
Sign in to follow this  
anessen

Empty array comparison

Recommended Posts

Quick question (ish :D)

I have an array like this:

myArray = [["item one", "item two"], [], [], ["blah", "blah"]];

I would like to be able to check to see if (myArray select _x) is an empty array, like (myArray select 1) would be.

(myArray select 1) == [] //Doesn't work :(

Share this post


Link to post
Share on other sites

Yup. Something like this I'd guess.

_array = [[1],[2],[]];
_element = _array select 2;
hint format ["elements of nested array element: %1",count _element];

Share this post


Link to post
Share on other sites

You can't compare arrays with == and others, you will have to walk through each array item and compare it by yourself.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×