Maxscript beginner confused with arrays

Hi! I’m learning maxscript and having some problems with arrays. I believe I made this work at least once but now it’s not working so, I guess I accidentally broke it :slight_smile:

This was supposed to give the vertex number of the selected vertex which is stored in the 2nd value of the array:

vert_sel_init = #{}
vert_sel_init = polyop.getVertSelection$
vert_sel_init[2]

I create a box, convert to editable poly and select two vertices manually. When I execute only the three lines above, I get this output:

#{}
#{1, 3}
false

What am I doing wrong?

Thanks for looking!

There is a difference between arrays and bitarrays.
What you get back from the function is a bitarray.

polyop.getVertSelection <Poly poly>
Returns the current vertex selection as a bitarray

Here is some information about arrays in maxscript :
http://knol.google.com/k/maxscript-arrays?collectionId=2lijysgth48w1.35#

Here is some information about bitarrays in maxscript :
http://knol.google.com/k/maxscript-bitarray?collectionId=2lijysgth48w1.35#

Thanks a lot :slight_smile: Problem solved.