ds_list_find_index

Finds the position of a given value in the list.

Syntax:

GML Code Example

ds_list_find_index(id, val);


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


Returns: Real


Description

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: If the list index that you wish to find is an array value, the function will return -1.


Example:

GML Code Example

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".





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here