BIS fnc arrayPush: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (description)
(Page filling, comment cleanup)
Line 1: Line 1:
{{Function|= Comments
{{Function|= Comments
____________________________________________________________________________________________
____________________________________________________________________________________________
Line 8: Line 7:
____________________________________________________________________________________________
____________________________________________________________________________________________


| <pre>
| This function adds an element to the end of an array and returns the array.<br />
/************************************************************
'''The array is passed by reference''' so changes inside the function will be reflected outside of it.
Array Push
 
{{Feature arma3|Use [[append]] or [[pushBack]] instead.}} |= Description
____________________________________________________________________________________________


This function adds an element to the end of an array and returns the array.
| [array, element] call [[BIS_fnc_arrayPush]] |= Syntax
The array is passed by reference so changes inside the function will be reflected
outside of it.


Example:
|p1= array: [[Array]] |= Parameter 1
array = [1,2,3]
[array, 4] call BIS_fnc_arrayPush
array2 = [[5,6,7], [8]] call BIS_fnc_arrayPush


array is now [1,2,3,4]
|p2= element: [[Anything]] |= Parameter 2
array2 is now [5,6,7,[8]]
************************************************************/


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small>
| [[Array]] - modified ''array'' |= Return value
{{Feature arma3|Use [[pushBack]] instead.}} |= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_arrayPush]]; --> |= Syntax
|x1= <code><nowiki>_newArray = [</nowiki>[0,1,2], 3] [[call]] [[BIS_fnc_arrayPush]]; {{codecomment|// _newArray is [0,1,2,3]}}</code> |= Example 1
 
|p1= |= Parameter 1
 
| |= Return value
____________________________________________________________________________________________


|x1= <code></code> |=  
|x2= <code>_array = [0,1,2]; [_array, [3]] [[call]] [[BIS_fnc_arrayPush]]; {{codecomment|// _array is [0,1,2,[3]]}}</code> |= Example 2
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[pushBack]], [[BIS_fnc_arrayPushStack]] |= See also
| [[append]], [[pushBack]], [[BIS_fnc_arrayPushStack]] |= See also
 
}}
}}


Line 46: Line 33:
<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section BEGIN -->
<dd class="notedate">Posted on Aug 1, 2014 - 21:15
 
<dt class="note">[[User:ffur2007slx2_5|ffur2007slx2_5]]<dd class="note">
(A3 1.26) It is recommended to use [[pushBack]] instead of [[BIS_fnc_arrayPush]].
<code>_array = [1,2,3];
_array [[pushBack]] 4; //same as [_array, 4] [[call]] [[BIS_fnc_arrayPush]];
</code>
<!-- Note Section END -->
<!-- Note Section END -->
</dl>
</dl>

Revision as of 19:19, 10 May 2018

Hover & click on the images for description

Description

Description:
This function adds an element to the end of an array and returns the array.
The array is passed by reference so changes inside the function will be reflected outside of it.
Arma 3
Use append or pushBack instead.
Execution:
call
Groups:
Uncategorised

Syntax

Syntax:
[array, element] call BIS_fnc_arrayPush
Parameters:
array: Array
element: Anything
Return Value:
Array - modified array

Examples

Example 1:
_newArray = [[0,1,2], 3] call BIS_fnc_arrayPush; // _newArray is [0,1,2,3]
Example 2:
_array = [0,1,2]; [_array, [3]] call BIS_fnc_arrayPush; // _array is [0,1,2,[3]]

Additional Information

See also:
appendpushBackBIS_fnc_arrayPushStack

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

Notes

Bottom Section