Jump to content
Sign in to follow this  
Horrace

select command

Recommended Posts

Hi,

Normally people use select with literal 0,1,2 etc.

Is it possible to use a variable eg.

_index = 0;
_unit = _this select _index

I've tried but doesn't appear to work. It's late maybe i'm just missing something. (Probably sleep)

Thanks,

Share this post


Link to post
Share on other sites

You're including a ; at the end of the second line right?

Share this post


Link to post
Share on other sites

You can use any variable or expression that evaluates to a number. Why your example doesn't work isn't clear. Perhaps _this isn't an array.

Share this post


Link to post
Share on other sites

My fault.

I was trying to do this :

_myArray = [0,0,0];

_value = 2;

(_myArray select _value) = 5;

Thinking that this would set the second element to 5.

What I should have done is

_myArray set[_value,5];

Doh!

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  

×