CreateArray ()

Result type:  array.

Definition:  Creates an empty associative array object.

Associative arrays use the syntax arrayname[key], where key can be any text up to 31 characters, an integer, or a date (internally, integers and dates are represented as text formatted so that lexical sort order matches numeric/date sort order). Data values can be any other type.

let myArray = CreateArray()

let myArray[0] = "thing"

let myArray["mykey"] = myArray[0]

let myArray[’31/1/12’] = 500

In the current implementation, insertion into an associative array is O(N). Retrieval is O(log N).

Arrays, like Tables, are always passed by reference, so if you assign an array to another variable, or pass it as a parameter to a function, you are not copying the array. If you want to copy an array, you must allocate a new array with CreateArray and explictly copy all of its members.

Availability:  available within MWScript handlers.

See Also:

CountElements: Get the size of an associative array

DeleteElement: Remove a key from an associative array

ElementExists: Check if a key exists in an associative array

ParamsFromArray: Expand array values to a variable parameter list