What is the differences between Arrays and BitArrays?

MAXScript Frequently Asked Questions

An Array in MAXScript can contain any number of elements, and each element can be of any type incl. integers, floats, strings, Point3 values, colors, and even other arrays.

A BitArray on the other hand can contain only one type of information. Nomen Est Omen - this type is a single bit, a binary digit. A bit can be either set (1, true) or not set (0, false). This means that a BitArray can only store binary information, any number of bits representing true or false values. Obviously, a bitArray is much more memory-efficient as it can store 8 values in a single byte, while a single element of a regular array requires multiple bytes to store a single value!

A bitArray can be very useful when getting and setting face properties like selected status etc.

You can convert a bitArray to an Array, and an Array containing only true and false values to bitArray.


that appending elements to a bitArray tends to be slower than appending elements to a regular array. Pre-defining a bitArray to the desired size first and then setting its elements by index is much, much faster.

See also

Array Values

BitArray Values

How To ... Develop A Transform Lock Script

How do I create a multi-dimensional array?

Frequently Asked Questions