Finds the position of a given value in the list.


ds_list_find_index(id, val);

Argument Description
id The id of the list to use.
val The value to find.

Returns: Real


With this function you can check the given list for a value and the position within the list for that value will be returned. Note that if there are more than one entries in the list with the same value, the position of any one of them may be returned, and that if the value does not exist, then -1 will be returned. Note that the value can be an array, which you can check with the function is_array.


pos = ds_list_find_index(list, "Player1");

The above code checks the list indexed in the variable "list" for the value "Player1" and stores the returned position in the variable "pos".

Back: DS Lists
Next: ds_list_find_value
© Copyright YoYo Games Ltd. 2018 All Rights Reserved