Maps in BHL
May 21, 2026 ยท View on GitHub
Maps are declared with [KeyType]ValueType and initialized with []:
[string]int scores = []
[int]string names = []
[Id]int enumMap = []
Operations
scores["player1"] = 100 // add / update
scores.Remove("player1")
scores.Clear()
int score = scores["player1"]
int count = scores.Count
bool hasKey = scores.Contains("player1")
bool exists, int value = scores.TryGet("player2")
Inline initialization
[string]int scores = [["player1", 100], ["player2", 200]]
If the same key appears more than once, the last value wins.
Iteration
foreach(string player, int score in scores) {
// use player and score
}