-
Notifications
You must be signed in to change notification settings - Fork 0
deleteAt
ffredyk edited this page Jul 23, 2026
·
1 revision
Array
Binary — <array> deleteAt <index>.
<array> deleteAt <number>
Removes the element at the given zero-based index from the array. Returns the deleted value. If the index is out of range, returns nil and the array is unchanged.
Checks bounds. If valid, retrieves the element at index, removes it from the list (shifting subsequent elements left), and returns the retrieved value. O(n) due to shift.
_arr = ["a", "b", "c", "d"];
_removed = _arr deleteAt 1; // returns "b", _arr is ["a","c","d"]_queue = [1, 2, 3, 4];
_next = _queue deleteAt 0; // returns 1, _queue is [2,3,4]_stack = [1, 2, 3];
_top = _stack deleteAt (count _stack - 1); // returns 3if (_index >= 0 && _index < count _arr) then {
_val = _arr deleteAt _index;
};_removeByValue = {
params ["_arr", "_val"];
_idx = _arr find _val;
if (_idx != -1) then { _arr deleteAt _idx };
};Not thread-safe. Array must belong to the current scheduler.
- deleteRange — remove multiple elements
- pushBack — append element
- select — element access
- find — find element index
- resize — change array size
- 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