Jump to content
Sign in to follow this  
uiox

(arrayoftask select _i) set  [0,1]

Recommended Posts

If this don't work how i can change a value in an array of arrays?

[[0,1,2,3],[0,1,2,3]]

I want to put 1 in the first value of the first array...

So,

(ArrayOfTask select 0) set [0,1]

If this not work how i can do it?

Thanks

Share this post


Link to post
Share on other sites

The solution of this problem by Spinor :

To change an element of a subarray you have to use Set twice, because the select command only reads a value, it´s result is no longer related to the original array.

To change element _j of the _ith subarray:

_subarray = MyArray select _i

_subarray Set [_j,1]

MyArray Set [_i, _subarray]

The following should do the same:

MyArray Set [_i, (MyArray select _i) Set [_j, 1]]

For subsubarrays this should work accordingly.

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  

×