Skip to content
ffredyk edited this page Jul 23, 2026 · 1 revision

append

Category

Array

Arity

Binary<array> append <otherArray>.

<array> append <array>

Description

Appends all elements from the right-hand array into the left-hand array. This is a bulk operation — more efficient than repeated pushBack calls. No return value (void).

How It Works

Calls List<Value>.AddRange() on the underlying list. All elements from the source array are added in order. The source array is not modified.

Usage

Merge arrays

_arr1 = [1, 2, 3];
_arr2 = [4, 5, 6];
_arr1 append _arr2;            // _arr1 is [1,2,3,4,5,6]

Collecting results

_allUnits = [];
_allUnits append _infantry;
_allUnits append _vehicles;
_allUnits append _air;

Array concatenation helper

_concat = {
    params ["_a", "_b"];
    _result = [];
    _result append _a;
    _result append _b;
    _result
};
_combined = [_arr1, _arr2] call _concat;

vs pushBack

// Bad — many individual pushes
{ _target pushBack _x } forEach _source;

// Good — single bulk append
_target append _source;

Thread Safety

Not thread-safe. Both arrays must belong to the current scheduler.

See Also

SQ# Wiki

Home

Engine Docs

Migration

Commands

Value Constructors

Arithmetic

Comparison

Logic

Array

String

Math

Random

Type & Introspection

HashMap

Code Execution

Concurrency

Scheduler

Thread Safety

Error

Output

Time

Multiplayer

Compiler

Clone this wiki locally