-
Notifications
You must be signed in to change notification settings - Fork 0
resize
ffredyk edited this page Jul 23, 2026
·
1 revision
Array
Binary — <array> resize <newSize>.
<array> resize <number>
Changes the size of the array to the given value. If the new size is larger, new slots are filled with nil. If smaller, elements beyond the new size are truncated. No return value (void).
-
Growing: adds
nilvalues until the list reaches the target size. -
Shrinking: removes elements from the end via
RemoveRange. - Same size: no-op.
_arr = [];
_arr resize 10; // _arr is [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil]
// Now use set to assign:
_arr set [0, "first"];
_arr set [9, "last"];_arr = [1, 2, 3, 4, 5];
_arr resize 2; // _arr is [1, 2] (3,4,5 discarded)_arr resize 0; // _arr is [] (empty)_arr = [1, 2, 3];
_arr resize 5; // _arr is [1, 2, 3, nil, nil]
_arr set [4, 99]; // _arr is [1, 2, 3, nil, 99]Not thread-safe. Array must belong to the current 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