No sort of an Array in iPhone dev

I have a 2Dimensional array:

arrayNew.Push(new Array(arr[0],arr[1]));
arrayNew.Sort();

I get: “Sort is not a member of Object”

So I have to put arrayNew() through a for loop and manually sort it?

Also I had problems with Operators, is there any webpage or something that shows all the differences between iPhone dev and regular scripting in Unity?

Thanks.

you need to assign your array to a correctly typed variable.
JS on the iphone is like #pragma strict on the regular Unity without any dynamic typing.

the error you get tries to explain you that you use an object of class Object, not one of class Array or whatever the arrays in JS have class wise.
(the same applies to objects you get out of arrays, so don’t forget casting where required)

how does your arrayNew definition and initialization look like?

I have this:

var arrayNew = new Array();

Then I tried this, but I still received the same error:

var arrayNew : Array = new Array();

I’m doing something wrong.

This seems to works for me:

var testArray: Array = new Array();

testArray.Push("Foo");
testArray.Push("Bar");

testArray.Sort();
	
for (var i: int = 0; i < testArray.length; i++) {
	Debug.Log(testArray[i].ToString());	
}

Producing this output:

Bar
Foo

By the way your other array, arr, will also need to be of type Array or be a type of your own devising which defines a Sort method.