Array.Array Manual     Reference     Scripting  
Scripting > Runtime Classes > Array
Array.Array

static function Array (sizeArr : int) : Array

Description

Creates an Array of a fixed size.

var arr = new Array(5);
Debug.Log(arr.length);

static function Array (arrObj : Object[]) : Array

Description

Initialize a JavaScript array from a .Net Array.

// Creates an empty int array of 5 positions, converts it to a
// JavaScript array and prints the content of the JavaScript array.

var intArray : int[] = new int[5];
var convertedArray : Array = new Array(intArray);

for (var i = 0; i < convertedArray.length; i++) {
Debug.Log("ConvertedArray[" +i + "]: " + convertedArray[i]);
}

static function Array () : Array

Description

Creates an empty array

var arr = new Array ();

// Add one element
arr.Push ("Hello");

// print the first element ("Hello")
print(arr[0]);