basic array question
hi.. maybe someone can help me with this one..
i am not figuring out how to use the find item on an array of coordinates..
what i want to do is find the item that have the especific z coordinate, doesnt matter whats the x or y
so i am trying something like this:
_array = #([1,2,3],[4,5,6],[7,8,9])
now i want to find the item with z == 6
i´ve tried
findItem _array 6 -- returns 0
findItem _array [*,*,6] -- Syntax error
thanks
Comments
hi
using
Collect()
is good enough, especially if you like to get all matched indexes. Max'sFindItem()
resurns only the index of the first occurrence of the given value. So, if you remove last line of the next function you'll modify it to return an array of all matched indexes --May try this one too. It s'd be more faster, i think.
my recent MAXScripts RSS (archive here)
Thank you very much the first
Thank you very much
the first one worked really well
the second it only returned the first occurrence like you said.. but its very good as well
i found a workaround _array =
i found a workaround
_array = #([1,2,3],[4,5,6],[7,8,9])
_arrayZ = #()
for i in 1 to _array.count do append _arrayZ _array[i].z
findItem _arrayZ 6
still apreciated if someone know another way to do it
thank you