GENERATE/PREV.gifGENERATE/NEXT.gif

Array : Collection :Mappable

An array is a variable length indexable sequence of values.

literals

#(<value>, <value>, ...)

#()      -- an empty array

methods

append <array> <value>

append value to array, growing it as necessary

deleteItem <array> <number>

delete element indexed by number from array, shrinking it in size by 1

join <array> <collection>

appends all the elements of the second argument to the array (first) argument

sort <array>

sorts the elements of the array into ascending order. All the elements must be comparable.

findItem <array> <value>

does a MAXScript '==' comparison between elements in the array and the target object and then returns the index of the first occurrence of the given value in the array or zero if the value is not in the array.

Values such as Point3s and Strings match if they have the same contents -- in prior releases they would only match if they were identically the same value object.

For example:

a = #("foo", "baz", "bar")

findItem a "baz"

works in the current release, but would fail to find anything in prior releases

s1 = "baz"

a = #("foo", s1, "bar")

findItem a s1

works in all releases because the value in the array is the same object as the target in the findItem

operators

<array>[<integer>]

<array>[<integer>] = <value>

<array> + <collection>

like join except a completely new array is constructed containing all the elements of the first and second operands

For example:

a = #(1,2,3,4)

join a #(5,6,7,8)

(cameras as array) + lights

props = getPropNames Node

join props getPropNames (classof $foo)

join props getPropNames $foo $dynamicOnly

sort props

properties

<array>.count