BIS fnc findInPairs: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " it's" to " it is")
m (page filled)
Line 1: Line 1:
{{Function|Comments=
{{Function
____________________________________________________________________________________________


| arma3 |Game name=
|game1= arma3


|0.76|Game version=
|version1= 0.76
____________________________________________________________________________________________


| <pre>/*
<!--|serverExec= server-->


Description:
<!--|arg= local-->
Searches the associative array for the 1st occurance of the key string and returns it is index.


Syntax:
<!--|eff= local-->
_index:number = [_associativeArray:array,_key:string] call BIS_fnc_findInPairs;


Example:
|descr= Searches the associative array for the first occurance of the key string and returns its index.
0 = [[["apple",3],["pear",2]],"apple"] call BIS_fnc_findInPairs;


Returns:
* if found: index (starting from 0)
* if not found: -1
*/


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |DESCRIPTION=
|s1= [array, key] call [[BIS_fnc_findInPairs]]
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_findInPairs]]; --> |SYNTAX=
|p1= array: [[Array]] - Array to search through


|p1= |PARAMETER1=
|p2= key: [[String]] - Key to search for


| |RETURNVALUE=
|r1= [[Number]] - Index of first occurence
____________________________________________________________________________________________


|x1= <code></code> |EXAMPLE1=
|x1= <code>[[["apple",3],["pear",2]],"apple"] [[call]] [[BIS_fnc_findInPairs]];{{cc|Returns 0}}</code>
____________________________________________________________________________________________


| [[BIS_fnc_addToPairs]], [[BIS_fnc_setToPairs]] |SEEALSO=
|exec= call
 
|seealso= [[find]] [[findIf]]


}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Arrays|{{uc:findInPairs}}]]
[[Category:Function Group: Arrays|{{uc:findInPairs}}]]
[[Category:Functions|{{uc:findInPairs}}]]
[[Category:Functions|{{uc:findInPairs}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:findInPairs}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:findInPairs}}]]

Revision as of 10:25, 15 September 2020

Hover & click on the images for description

Description

Description:
Searches the associative array for the first occurance of the key string and returns its index.
Execution:
call
Groups:
Uncategorised

Syntax

Syntax:
[array, key] call BIS_fnc_findInPairs
Parameters:
array: Array - Array to search through
key: String - Key to search for
Return Value:
Number - Index of first occurence

Examples

Example 1:
[[["apple",3],["pear",2]],"apple"] call BIS_fnc_findInPairs;// Returns 0

Additional Information

See also:
find findIf

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