View Full Version : Freaky Array issue? Or my error?

11 November 2005, 11:18 AM
Ok i getting bizzare issues with max tonight

i have problems with bitarrays it seems
i have say an bitarray

mybitarray #{1,2,3}
for example
now if i go

mybitarray[1] i get "false" instead of the value 1 or #{1}(which ever its supposed to output)

Is this something im doing? Am i expecting it to behave other than it should?

11 November 2005, 11:31 AM

You need to use arrays to access elements. As in arr = #(); arr[1]

You can also use this method for bitArrays, but it will only return whether there is an element there or not, true if selected.


11 November 2005, 11:48 AM
Indeed an bitarray is very different to an array.

Usually, you do not need to know the value of the elements which are "false".
Then you can use a loop like this :
for currentValue in mybitarray do format "%\n" currentValue
And you will know the value of the elements which are true (but not the others)

It is the normal usage of an bitarray...

11 November 2005, 12:39 PM
Ok thanks guys clears things up a bit more.

Was wondering what the difrence between an array and a bitarray was. Now i know i should be able to get it right.

Thanks :)

CGTalk Moderation
11 November 2005, 12:39 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.