Skip to main content

ObservableMap

A list that can be observed for blend and other components

Properties

CountChanged

ObservableMap.CountChanged: RBXScriptSignal

Fires when the count changes.

KeyAdded

This item is read only and cannot be modified. Read Only
ObservableMap.KeyAdded: Signal<TKey>

Fires when a key is added

KeyRemoved

This item is read only and cannot be modified. Read Only
ObservableMap.KeyRemoved: Signal<TKey>

Fires when a key is removed

KeyValueChanged

This item is read only and cannot be modified. Read Only
ObservableMap.KeyValueChanged: Signal<(
TKey,
TValue,
TValue
)>

Fires when a key value changes, including add and remove.

CountChanged

ObservableMap.CountChanged: RBXScriptSignal

Fires when the count changes.

CountChanged

ObservableMap.CountChanged: RBXScriptSignal

Fires when the count changes.

Functions

new

ObservableMap.new() → ObservableMap<TKey,TValue>

Constructs a new ObservableMap

isObservableMap

ObservableMap.isObservableMap(valueany) → boolean

Returns whether the set is an observable map

ObserveValueForKey

ObservableMap.ObserveValueForKey(keyTKey) → Observable<TValue?>

Observes the value for the given key. Alias for ObservableMap.ObserveAtKey.

iterating over ObservableMap

for  (T) → (
(
T,
nextIndexany
) → ...any,
T?
) 
 in  ObservableMap  do

Allows iteration over the observable map

ObserveKeysBrio

ObservableMap:ObserveKeysBrio() → Observable<Brio<TKey>>

Observes all keys in the map

ObserveValuesBrio

ObservableMap:ObserveValuesBrio() → Observable<Brio<TKey>>

Observes all keys in the map

ObservePairsBrio

ObservableMap:ObservePairsBrio() → Observable<Brio<(
TKey,
TValue
)>>

Observes all keys in the map

Get

ObservableMap:Get(keyTKey) → TValue

Returns the value for the given key

ContainsKey

ObservableMap:ContainsKey(keyTKey) → boolean

Returns whether the map contains the key

GetCount

ObservableMap:GetCount() → number

Gets the count of items in the set

ObserveCount

ObservableMap:ObserveCount() → Observable<number>

Observes the count of the set

ObserveAtKeyBrio

ObservableMap:ObserveAtKeyBrio(keyTKey) → Observable<Brio<TValue>>

Observes the value for the given key.

ObserveAtKey

ObservableMap:ObserveAtKey(keyTKey) → Observable<TValue?>

Observes the value for the given key.

Set

ObservableMap:Set(
keyTKey,
valueTValue?
) → callback--

Call to remove the value if it was added

Adds the item to the set if it does not exists.

Remove

ObservableMap:Remove(keyTKey) → ()

Removes the item from the map if it exists.

GetValueList

ObservableMap:GetValueList() → {TValue}

Gets a list of all values.

GetKeyList

ObservableMap:GetKeyList() → {TKey}

Gets a list of all keys.

ObserveKeyList

ObservableMap:ObserveKeyList() → Observable<{TKey}>

Observes the list of all keys.

Destroy

ObservableMap:Destroy() → ()

Cleans up the ObservableMap and sets the metatable to nil.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructs a new ObservableMap",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "ObservableMap<TKey, TValue>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 25,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "isObservableMap",
            "desc": "Returns whether the set is an observable map",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 73,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "__iter",
            "desc": "Allows iteration over the observable map",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(T) -> ((T, nextIndex: any) -> ...any, T?)"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 82,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "ObserveKeysBrio",
            "desc": "Observes all keys in the map",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<TKey>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 91,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "ObserveValuesBrio",
            "desc": "Observes all keys in the map",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<TKey>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 101,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "ObservePairsBrio",
            "desc": "Observes all keys in the map",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<(TKey, TValue)>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 111,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "Get",
            "desc": "Returns the value for the given key",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "TKey"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "TValue"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 153,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "ContainsKey",
            "desc": "Returns whether the map contains the key",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "TKey"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 164,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "GetCount",
            "desc": "Gets the count of items in the set",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 174,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "ObserveCount",
            "desc": "Observes the count of the set",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<number>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 183,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "ObserveAtKeyBrio",
            "desc": "Observes the value for the given key.",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "TKey"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<TValue>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 193,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "ObserveAtKey",
            "desc": "Observes the value for the given key.",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "TKey"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<TValue?>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 209,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "ObserveValueForKey",
            "desc": "Observes the value for the given key. Alias for [ObservableMap.ObserveAtKey].",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "TKey"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<TValue?>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 225,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "Set",
            "desc": "Adds the item to the set if it does not exists.",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "TKey"
                },
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "TValue?"
                }
            ],
            "returns": [
                {
                    "desc": "Call to remove the value if it was added",
                    "lua_type": "callback"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 233,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "Remove",
            "desc": "Removes the item from the map if it exists.",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "TKey"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 276,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "GetValueList",
            "desc": "Gets a list of all values.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ TValue }"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 286,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "GetKeyList",
            "desc": "Gets a list of all keys.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ TKey }"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 298,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "ObserveKeyList",
            "desc": "Observes the list of all keys.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<{ TKey }>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 310,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "Destroy",
            "desc": "Cleans up the ObservableMap and sets the metatable to nil.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 342,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "CountChanged",
            "desc": "Fires when the count changes.",
            "lua_type": "RBXScriptSignal",
            "source": {
                "line": 51,
                "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
            }
        },
        {
            "name": "KeyAdded",
            "desc": "Fires when a key is added",
            "lua_type": "Signal<TKey>",
            "readonly": true,
            "source": {
                "line": 40,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "KeyRemoved",
            "desc": "Fires when a key is removed",
            "lua_type": "Signal<TKey>",
            "readonly": true,
            "source": {
                "line": 48,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "KeyValueChanged",
            "desc": "Fires when a key value changes, including add and remove.",
            "lua_type": "Signal<(TKey, TValue, TValue)>",
            "readonly": true,
            "source": {
                "line": 56,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "CountChanged",
            "desc": "Fires when the count changes.",
            "lua_type": "RBXScriptSignal",
            "source": {
                "line": 63,
                "path": "src/observablecollection/src/Shared/ObservableMap.lua"
            }
        },
        {
            "name": "CountChanged",
            "desc": "Fires when the count changes.",
            "lua_type": "RBXScriptSignal",
            "source": {
                "line": 52,
                "path": "src/observablecollection/src/Shared/ObservableMapSet.lua"
            }
        }
    ],
    "types": [],
    "name": "ObservableMap",
    "desc": "A list that can be observed for blend and other components",
    "source": {
        "line": 5,
        "path": "src/observablecollection/src/Shared/ObservableMap.lua"
    }
}