Page tree
Skip to end of metadata
Go to start of metadata



Introduced in

Version:1.00

Description

Description:

Returns the 0-based position of the first array element (case-sensitive) that matches x, returns -1 if not found.

Note: You cannot locate an array within an array using this command.

Syntax

Syntax:array find x
Parameters:
  • array: Array - Array to search in.
  • x: Any Value - Any value, except Array, to search for in the array.
Return Value:Number - A 0-based position of the first array element that matches x, -1 if not found.

Examples

Examples:[apples,"Oranges",PEARS] find "Oranges" .... result is 1if ((magazines player) find "Strela" > -1) then {hint "I got a Strela"}

Additional Information

See also: count, in Array
Multiplayer:
Problems:

Notes







Posted on September 7, 2011
Richard Kissel
Because strings act like arrays in many ways, you can use this command to find the position of the first matching character or string. "Hello, World!" find ","; will return 5