BIS fnc returnNestedElement: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " <h3 style="display:none">Notes</h3> <dl class="command_description"> <!-- Note Section BEGIN --> <!-- Note Section END --> </dl> " to "")
m (Text replacement - "Numbers" to "Numbers")
 
(22 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Function|Comments=
{{RV|type=function


| arma2 |Game name=
|game1= arma2
|version1= 1.00


|1.00|Game version=
|game2= arma2oa
|version2= 1.50


|gr1= Arrays |GROUP1=
|game3= tkoh
|version3= 1.00


| Function to return an item at a path in an array. |Description=
|game4= arma3
|version4= 0.50


| [array, path] call [[BIS_fnc_returnNestedElement]] |Syntax=
|gr1= Arrays


|p1= array: [[Array]] |Parameter 1=
|descr= Function to return an item at a path in an array.


|p2= path: [[Array]] of [[Number|Numbers]] |Parameter 2=
|s1= [array, path] call [[BIS_fnc_returnNestedElement]]


| [[Anything]] - [[nil]] if path is incorrect |Return value=
|p1= array: [[Array]]


|x1= <code>_array = [[1, 2], [3, 4]];
|p2= path: [[Array]] of [[Number]]s
_value = [_array, [0, 1]] [[call]] [[BIS_fnc_returnNestedElement]]; {{codecomment|// returns 2}}</code> |Example 1=


| [[BIS_fnc_findNestedElement]], [[BIS_fnc_findAllNestedElements]], [[BIS_fnc_removeNestedElement]], [[BIS_fnc_setNestedElement]] |See also=
|r1= [[Anything]] - [[nil]] if path is incorrect
}}


<h3 style="display:none">Bottom Section</h3>
|x1= <sqf>private _array = [[1, 2], [3, 4]];
[[Category:Functions|{{uc:returnNestedElement}}]]
_value = [_array, [0, 1]] call BIS_fnc_returnNestedElement; // returns 2</sqf>


[[Category:{{Name|arma2}}: Functions|{{uc:returnNestedElement}}]]
|seealso= [[BIS_fnc_findNestedElement]] [[BIS_fnc_findAllNestedElements]] [[BIS_fnc_removeNestedElement]] [[BIS_fnc_setNestedElement]]
[[Category:{{Name|arma2oa}}: Functions|{{uc:returnNestedElement}}]]
}}
[[Category:{{Name|tkoh}}: Functions|{{uc:returnNestedElement}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:returnNestedElement}}]]

Latest revision as of 23:38, 12 July 2022

Hover & click on the images for description

Description

Description:
Function to return an item at a path in an array.
Execution:
call
Groups:
Arrays

Syntax

Syntax:
[array, path] call BIS_fnc_returnNestedElement
Parameters:
array: Array
path: Array of Numbers
Return Value:
Anything - nil if path is incorrect

Examples

Example 1:
private _array = [[1, 2], [3, 4]]; _value = [_array, [0, 1]] call BIS_fnc_returnNestedElement; // returns 2

Additional Information

See also:
BIS_fnc_findNestedElement BIS_fnc_findAllNestedElements BIS_fnc_removeNestedElement BIS_fnc_setNestedElement

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