SplitScript reference / Map<K, V>

Map<K, V>

type constructor

Map<K where Equatable, V>

Stores an insertion-ordered association from unique keys to values.

Keys are compared with Equatable. The representation is tuned for the small and medium lookup tables common in autosplitters; no complexity guarantee is part of the API. The map retains its identity and contents across ticks, so aliases observe every mutation. Indexing returns the stored value and traps when the key is absent; use Map.containsKey first when absence is expected. This keeps maps whose values are themselves optional unambiguous without adding another lookup operation.

Examples

Store and read route metadata

let routes = Map.new<String, u32>()
routes["Atrium"] = 12
if routes.containsKey("Atrium") {
    print(routes["Atrium"])
}

Methods

MemberDescriptionAvailable through
clearRemoves every entry while preserving this map's identity.
containsKeyReports whether an equal key is present.
insertInserts a key-value pair or replaces the value for an existing key.
isEmptyReports whether this map contains no entries.
iteratorCreates an insertion-order cursor over this map's entries.
lengthReturns the number of stored key-value pairs.
newCreates an empty map.
removeRemoves the entry for a key when present.