-
Notifications
You must be signed in to change notification settings - Fork 0
get
ffredyk edited this page Jul 23, 2026
·
1 revision
HashMap / Shared / Array
Unary or Binary, depending on context.
// Unary: on Shared
get <shared>
// Binary: on HashMap or Array
<hashmap> get <key>
<array> get <index> // same as select
<shared> get <void> // unary read
Multi-purpose retrieval command:
-
HashMap:
_map get _key— returns the value for the given key, ornilif not found. -
Shared:
get _sharedVar— atomically reads the current value of a shared (atomic) variable. -
Array:
_arr get _index— equivalent to select, returns element at index (nil if out of range).
The host dispatches based on the left operand type:
- HashMap → dictionary lookup.
- Shared → atomic read of the underlying value.
- Array → delegate to
selectbehavior.
_map = createHashMapFromArray ["hp", 100, "name", "player"];
_hp = _map get "hp"; // 100
_name = _map get "name"; // "player"
_missing = _map get "xyz"; // nilshared _counter = 0;
_counter add 1;
_val = get _counter; // read current value atomically_arr = [10, 20, 30];
_arr get 0; // 10
_arr get 99; // nil (out of range)_val = _map get _key;
if (isNil "_val") then {
systemChat f"Key '{_key}' not found";
};- HashMap get: ReadOnly on the hashmap. Safe from owning scheduler.
- Shared get: Atomic read — thread-safe from any scheduler.
- Array get: ReadOnly. Safe from owning scheduler.
- set — store value
- select — array element (same as array get)
- createHashMap — create empty hashmap
- shared — declare shared variable
- 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