Skip to main content

The "array_find_dim" Function

Syntax#

array_find_dim(id, val);
ArgumentTypeDescription
idarrayThe index of a previously-created array to search
valanyThe value to search for

Description#

Searches a multidimensional array for the given value and returns the dimension in which it exists, or -1 if the value is not found in the array. If the input is not an array, but happens to match the search value regardless, 0 will be returned instead.

Example#

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