-
Notifications
You must be signed in to change notification settings - Fork 0
select
ffredyk edited this page Jul 23, 2026
·
1 revision
Array / String
Binary — <array|string> select <index>.
<array> select <index>
<string> select <index>
Returns the element at the given zero-based index from an array, or the character at the given index from a string. Out-of-range index returns nil (no error thrown — matches Arma SQF behavior).
-
Array: bounds-checks the index. Returns
array[index]. O(1). -
String: bounds-checks the index. Returns single-character string via
string[index].ToString(). O(1). -
Out of range: returns
nilsilently (no exception).
_arr = ["a", "b", "c"];
_first = _arr select 0; // "a"
_second = _arr select 1; // "b"
_last = _arr select (count _arr - 1); // "c"
_oob = _arr select 99; // nil (out of range)_name = "Arma";
_char0 = _name select 0; // "A"
_char2 = _name select 2; // "m"_val = _arr select _index;
if (!isNil "_val") then {
process(_val);
};for "_i" from 0 to (count _arr - 1) do {
_elem = _arr select _i;
systemChat f"Element {_i}: {_elem}";
};ReadOnly — pure query. Safe from any scheduler.
- 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