Arma 3 Scripting

Command in Arrays

findAny

Also available as Markdown and JSON, or read the original wiki page.

Description

Returns the zero-based index of the first element in array A that also exists in array B. If no common elements exist it returns -1.

Similar in functionality as find's first syntax, but the second parameter is an array of elements to find.

Syntax

searchIn findAny toFind

Parameters:

Returns: Number - the index of the first found item

Examples

Example 1

[0,1,2,3,4] findAny [2,4,6,8]; // returns 2

Example 2

[0,1,2,3,4] findAny [8,6,4,2]; // returns 2

Example 3

[0,1,2,3,4] findAny [5,7,9]; // returns -1

See also

find · findIf