BIS fnc arrayFindDeep: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - " <h3 style="display:none">Notes</h3> <dl class="command_description"> <!-- Note Section BEGIN --> <!-- Note Section END --> </dl>" to "") |
Lou Montana (talk | contribs) m (Text replacement - " *\| *([Cc]omments|COMMENTS|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments \("local" or "global"\)|Multiplayer Effects \("local" or "global"\)|Multiplayer Execution \("server" o...) |
||
Line 1: | Line 1: | ||
{{Function | {{Function | ||
| arma2 | | arma2 | ||
|1.00 | |1.00 | ||
|gr1= Arrays | |gr1= Arrays | ||
| Searches an array for a specific value and returns its index. | | Searches an array for a specific value and returns its index. | ||
| [array,value] call [[BIS_fnc_arrayFindDeep]] | | [array,value] call [[BIS_fnc_arrayFindDeep]] | ||
|p1= array: [[Array]] - Array to be searched | |p1= array: [[Array]] - Array to be searched | ||
|p2= value [[Anything]] - Value to be searched for | |p2= value [[Anything]] - Value to be searched for | ||
| [[Array]] - Returns array with index of found element, if it wasn't found it returns -1 | | [[Array]] - Returns array with index of found element, if it wasn't found it returns -1 | ||
<!--- | <!--- | ||
Line 22: | Line 22: | ||
---> | ---> | ||
|x1= <code>[ [1,2,3,4,5], 3 ] [[call]] [[BIS_fnc_arrayFindDeep]];//Returns [2]</code> | |x1= <code>[ [1,2,3,4,5], 3 ] [[call]] [[BIS_fnc_arrayFindDeep]];//Returns [2]</code> | ||
| [[BIS_fnc_addToPairs]], [[find]], [[select]], [[BIS_fnc_removeIndex]] | | [[BIS_fnc_addToPairs]], [[find]], [[select]], [[BIS_fnc_removeIndex]] | ||
}} | }} | ||
Revision as of 22:40, 17 January 2021
Description
- Description:
- Searches an array for a specific value and returns its index.
- Execution:
- call
- Groups:
- Arrays
Syntax
- Syntax:
- [array,value] call BIS_fnc_arrayFindDeep
- Parameters:
- array: Array - Array to be searched
- value Anything - Value to be searched for
- Return Value:
- Array - Returns array with index of found element, if it wasn't found it returns -1
Examples
- Example 1:
[ [1,2,3,4,5], 3 ] call BIS_fnc_arrayFindDeep;//Returns [2]
Additional Information
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note