I’m trying to convert a few html/javascript array functions into unityscript for a statistics project in unity. This one is confusing me because they use the “this” keyword. It creates a 2 dimensional array. Any help rewriting this in unityscript would be appreciated…I just need help with the “this” line. Later there is a line that calls this using New. Like xy=new makeArray2(). I don’t think either of these are allowed in unityscript right?
function makeArray2 (X,Y)
{
var count;
for (var count = 0; count < X; count++)
this[count] = new makeArray(Y);
}
function makeArray (Y)
{
var count;
this.length = Y+1;
for (var count = 0; count <= Y+1; count++)
this[count] = 0;
}