The "array_find_row" Function

Syntax

array_find_row(id, value);
ArgumentTypeDescription
idarrayThe index of a previously-created array to search
valuereal/stringThe value to search for

Description

Searches an array for the given value and returns the row index. If the value cannot not found, -1 will be returned instead.

This script can be used to search both 1D and 2D arrays.

Example

//Find index of the target string
var xx = array_find_col(my_array, "Items held:");
var yy = array_find_row(my_array, "Items held:");
//Draw the string and the corresponding value held in the following column
draw_text(25, 25, my_array[xx, yy] + string(my_array[xx + 1, yy]));