matrix In javascript

Hi!

I was wondering if it is really not possible to create a array of an array (in my country we call it a matrix) in javascript.

Like:

var matrix = new type[10][10];

is that really not possible in JS?

I would assume someone using the word “matrix” in Unity is usually talking about Matrix4x4.

–Eric

Sorry to reply again,

i tried to do what i want in some other way, but is kinda messy.

What i want is a bidimensional array like:

|x x x x|
|x 0 x x|
|x x x 0|
|x 0 x x|

the x will represent the empty position in my grid, the 0 will represent the occupied positions, so would be good to have a bidimensional array for a smart implementation of it.
I know i can simulate it, but if anyone know if Unity’s JS suports it please let me know.

Did you click the link I provided (the first one)?

–Eric

Oh! that will get it done!

thanks!

I do this:

class Mapa {
var id : int;
}
function Start (){
var arr = new Array ();
arr.Push (new Mapa());
}

I’m not sure what that’s accomplishing. Also, Arrays are quite slow compared to built-in .NET arrays.

–Eric