Bentley
Member
I just clicked on "array_height_2d" and found the function is deprecated. I then read about arrays and the manual talks about arrays with multiple dimensions and gives example code using [row][col] (or [col][row]) syntax.
In addition, the error highlighting doesn't show up when you code that way, but you get an error message when you run the project.
Is it just that the manual updated a little prematurely?
Also, as this is how arrays will be, can you initialize a multi-dimensional array in one line (like you would with a ds_grid)?
Or does it have to be something like this:
What if I run the above code but set
Will I access that internal array via:
I assume this would be incorrect right?
What if your array, "a", has a third dimension. How would GM know whether you're accessing the external arrays third dimension versus accessing the internal array directly at position 0. (Sorry if my terminology is off). Just trying to get a grasp of what's coming.
In addition, the error highlighting doesn't show up when you code that way, but you get an error message when you run the project.
Is it just that the manual updated a little prematurely?
Also, as this is how arrays will be, can you initialize a multi-dimensional array in one line (like you would with a ds_grid)?
Or does it have to be something like this:
Code:
var a, rows, cols;
a = [];
rows = 5;
cols = 2;
for (var j = 0; j < rows; j++)
{
for (var i = 0; i < cols; i++)
{
a[rows][cols] = something;
}
}
Code:
a[3][3] = array_create(3);
Code:
var b = a[3][3];
b[0] = something;
b[1] = something;
b[2] = something;
Code:
a[3][3][0] // Would NOT access first position of array at row 3 col 3
Last edited: