The "array_find_col" Function

Syntax

array_find_col(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 column index. If the value cannot not found, -1 will be returned instead.

This script should be used with 2D arrays only, as 1D arrays will always return 0. To find the index of a value in a 1D array, use array_find_row.

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]));