-
Notifications
You must be signed in to change notification settings - Fork 0
createHashMap
ffredyk edited this page Jul 23, 2026
·
1 revision
HashMap
Nular — createHashMap.
createHashMap
Creates a new empty hashmap (dictionary). HashMaps store key-value pairs with fast O(1) lookup. Keys and values can be of any type. Keys are compared by value — two equal numbers or strings are considered the same key.
Allocates a new Dictionary<Value, Value> with the SQ# equality comparer. The hashmap is mutable and owned by the current scheduler.
_map = createHashMap;
_map set ["health", 100];
_map set ["name", "player"];
_map set ["alive", true];_hp = _map get "health"; // 100
_name = _map get "name"; // "player"
_missing = _map get "xyz"; // nil (key not found)if (!isNil {_map get "health"}) then {
systemChat f"Health: {_map get "health"}";
};_config = createHashMap;
_config set ["maxPlayers", 32];
_config set ["difficulty", "hard"];
_config set ["timeLimit", 900];_player = createHashMap;
_player set ["name", "John"];
_stats = createHashMap;
_stats set ["hp", 100];
_stats set ["xp", 500];
_player set ["stats", _stats];Not thread-safe. HashMap must be owned by the current scheduler. Use freeze pattern for cross-scheduler sharing, or transfer ownership with sendTo.
- createHashMapFromArray — create from key-value array
- get — retrieve value by key
- set — store key-value pair
- 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