Returns the length of a given dimension of a 2D array.


array_length_2d(array, n);

Argument Description
array The array to check.
n The entry of the array to get the length of.

Returns: Real


With this function you can get the length (number of entries) of a the second dimension of an array. You supply the entry number for the first dimension and the function will return the number of second dimension entries that the array has (to find the length of the first dimension use the function array_height_2D). The function will return 0 if the variable given is not an array or 1 if the variable is a 1D array (as there is still 1 row).


for (var i = array_height_2d(a) - 1; i > -1; i--;)
   for (var j = array_length_2d(a, i) - 1; j > -1; j--;)
      a[i, j] = -1;

The above code will loop through a 2D array and set each entry to -1.

Back: Arrays
Next: array_height_2d
© Copyright YoYo Games Ltd. 2018 All Rights Reserved