Skip to main content

The "array_depth" Function

Syntax#

array_depth(id);
ArgumentTypeDescription
idarrayThe index of a previously-created array to check

Description#

Returns the number of dimensions contained in an array. If the input value is not an array, 0 will be returned instead.

Note that array dimensions are not required to have uniform depth. This function returns the deepest dimension contained within an array.

Example#

var my_array = [ 1, 2, 3, [ "a", "b", "c", [ ".", "!", "?" ] ] ];
draw_text(25, 25, string(array_depth(my_array)));