GENERATE/PREV.gifGENERATE/NEXT.gif

Arrays

An array in MAXScript is an ordered collection of values. The collection can contain any kind of value and you can index and iterate an array. You can write array literals directly in a program or build the collection with the array functions provided in MAXScript. For details, see the Array Collection topic. Array literals can be expressed in two forms:

#( <expr> { , <expr> } )

#()      -- empty array

In the first form, the braces {...} mean '0 or more repetitions' of any number of comma-separated expressions. Names in '<>' angle brackets are used to identify other kinds of constructs in MAXScript, in this case <expr> means any valid expression.

Examples:

#(1, 2, 3)

#()

#(1, "foo", #(1.2, -4, #fred), [1,2,3])      -- this one has a nested array

#(1, sin x, a * 2.3)      -- can contain expressions

Expressions in an array are evaluated when the array is built, so array literals in MAXScript are known as 'eager' literals, unlike, for example, those in Lisp or Smalltalk.

For details about expressions, see the Expressions topic. For details about the EBNF syntax specification scheme, see the Syntax Definitions in this Document topic.