-
Notifications
You must be signed in to change notification settings - Fork 0
pushBack
ffredyk edited this page Jul 23, 2026
·
1 revision
Array
Binary — <array> pushBack <element>.
<array> pushBack <any>
Appends a single element to the end of the array. Returns the index at which the element was inserted (the new last index). This matches Arma SQF pushBack behavior.
Thread Safety: Not thread-safe. Array must belong to current scheduler.
Adds the element to the underlying List<Value>, then returns Count - 1 (the index of the newly added element). The array grows by 1.
_arr = [1, 2, 3];
_idx = _arr pushBack 4; // returns 3, _arr is [1,2,3,4]
_arr pushBack 5; // _arr is [1,2,3,4,5]_enemies = [];
{
if (_x get "side" == "east") then {
_enemies pushBack _x;
};
} forEach _allUnits;_queue pushBack _newTask; // just append, don't need index_arr = [];
_lastIdx = _arr pushBack "first"; // 0
_lastIdx = _arr pushBack "second"; // 1Not thread-safe. Array must be owned by the current scheduler. Use freeze for cross-scheduler sharing, or sendTo to transfer ownership.
- Getting Started
- Language Guide
- Type System
- Control Flow
- Functions & Code
- Strings & Text
- Arrays & Collections
- Concurrency
- Promise System
- Thread Safety
- Host API & Embedding
- CLI Tool
- Bytecode Reference
- Multiplayer
- Syntax Sugar
- Optimization Guide
- Benchmarks
- count
- select
- pushBack
- append
- deleteAt
- deleteRange
- resize
- reverse
- sort
- find
- in
- forEach
- freeze
- thaw
- isFrozen
- currentScheduler
- clientOwner
- allSchedulers
- schedulerName
- schedulerExists
- schedulerBudget
- setSchedulerBudget
- fiberCount
- readyFiberCount
- waitingFiberCount
- schedulerLoad
- sendTo