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




Introduced in

Version:1.30

Description

Description:Searches for an element in an array and returns the path to the first occurrence. It is meant to be used with nested arrays, as it searches sub-arrays in the array. If the element is not in the array, the functions returns an empty array.

Syntax

Syntax:[array,element] call fn_vbs_arrayFindDeep
Parameters:
  • array: Array - Array to search.
  • element: Anything - Element to search for.
Return Value:Array - Path to the element in the array, or [] if the element is not in the array.

Warning

When using functions in VBS versions older than 3.4, certain limitations and requirements should be kept in mind - the main ones being that capitalization of the function name is crucial, and that #include "\vbs2\headers\function_library.hpp" has to be included in every script that utilizes it. More Category VBS Scripting Functions.

Examples

Examples:
_element = [[1,2,[3,4],3,2,1],3] call fn_vbs_arrayFindDeep //returns [2,0]
_element = [["a",2,player,false],false] call fn_vbs_arrayFindDeep //returns [3]
_element = [["a",2,player,false],true] call fn_vbs_arrayFindDeep //returns []
_element = [[1,2,3,[4,["a",["b","c"]],5],6],["b","c"]] call fn_vbs_arrayFindDeep //returns [3,1,1]

Additional Information

See also: find
Multiplayer: 
Problems: 

Notes






This function was included in previous versions; however, before v1.30 it was broken and would throw a syntax error.