[Solved] 2d Array

Is it safe (the right way) to do like this?

var a=Array( Array(),Array());

[Edit]Is Possible to do 2d arrays at all in Unity js?

[Edit] Feels like lingo before Director supported arrays :slight_smile:

a = new Array();
for (i=0;i<gridSize;i++){
a = new Array();
for (k=0;k<gridSize;k++){
a*[k] = DefCost;*
}
}
Is this the way to do it?
[Edit] Never mind, Got it.

There are also rectangular arrays like int[,] or float[,], so you can do things like “foo[5,6] = 7;” rather than use Array(), which is flexible but quite slow. In C# it’s “int[,] foo = new int[10,10];”. In Javascript it’s currently a little trickier since it’s not completely implemented, but see here for a simple way around that problem.

–Eric

Thanks Erik, hard to find good stuff about arrays.
I have been spoilt with the arrays functions in lingo.
Working in Director for 10 years but now moving over to Unity3D, and so far it has been a fun ride.
(FYI one of my 2d shockwave games Miniclip)