Skip to main content

ObservableCountingMap

An observable map that counts up/down and removes when the count is zero.

Properties

KeyAdded

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

Fires when an key is added

KeyRemoved

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

Fires when an key is removed.

KeyChanged

This item is read only and cannot be modified. Read Only
ObservableCountingMap.KeyChanged: Signal<T>

Fires when an item count changes

CountChanged

ObservableCountingMap.CountChanged: RBXScriptSignal

Fires when the total count changes.

Functions

new

ObservableCountingMap.new() → ObservableCountingMap<T>

Constructs a new ObservableCountingMap

isObservableMap

ObservableCountingMap.isObservableMap(valueany) → boolean

Returns whether the value is an observable counting map

ObserveKeysList

ObservableCountingMap:ObserveKeysList() → Observable<{T}>

Observes the current set of active keys

ObserveKeysSet

ObservableCountingMap:ObserveKeysSet() → Observable<{[T]true}>

Observes the current set of active keys

ObserveKeysBrio

ObservableCountingMap:ObserveKeysBrio() → Observable<Brio<T>>

Observes all keys in the map

Contains

ObservableCountingMap:Contains(keyT) → boolean

Returns whether the map contains the key

Get

ObservableCountingMap:Get(keyT) → number

Returns the count for the key or 0 if there is no key

GetTotalKeyCount

ObservableCountingMap:GetTotalKeyCount() → number

Gets the count of keys in the map

ObserveTotalKeyCount

ObservableCountingMap:ObserveTotalKeyCount() → Observable<number>

Observes the count of the keys in the map

Set

ObservableCountingMap:Set(
keyT,
amountnumber?
) → callback

Sets the current value

Add

ObservableCountingMap:Add(
keyT,
amountnumber?
) → callback

Adds the key to the map if it does not exists.

Remove

ObservableCountingMap:Remove(
keyT,
amountnumber?
) → callback

Removes the key from the set if it exists.

GetFirstKey

ObservableCountingMap:GetFirstKey() → T

Gets the first key

GetKeyList

ObservableCountingMap:GetKeyList() → {T}

Gets a list of all keys.

Destroy

ObservableCountingMap:Destroy() → ()

Cleans up the ObservableCountingMap and sets the metatable to nil.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructs a new ObservableCountingMap",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "ObservableCountingMap<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 23,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "isObservableMap",
            "desc": "Returns whether the value is an observable counting map",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 70,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "ObserveKeysList",
            "desc": "Observes the current set of active keys",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<{ T }>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 78,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "ObserveKeysSet",
            "desc": "Observes the current set of active keys",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<{ [T]: true }>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 94,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "ObserveKeysBrio",
            "desc": "Observes all keys in the map",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<T>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 133,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "Contains",
            "desc": "Returns whether the map contains the key",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 167,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "Get",
            "desc": "Returns the count for the key or 0 if there is no key",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 178,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "GetTotalKeyCount",
            "desc": "Gets the count of keys in the map",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 188,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "ObserveTotalKeyCount",
            "desc": "Observes the count of the keys in the map",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<number>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 196,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "Set",
            "desc": "Sets the current value",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "T"
                },
                {
                    "name": "amount",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "callback"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 206,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "Add",
            "desc": "Adds the key to the map if it does not exists.",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "T"
                },
                {
                    "name": "amount",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "callback"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 229,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "Remove",
            "desc": "Removes the key from the set if it exists.",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "T"
                },
                {
                    "name": "amount",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "callback"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 290,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "GetFirstKey",
            "desc": "Gets the first key",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 302,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "GetKeyList",
            "desc": "Gets a list of all keys.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ T }"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 311,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "Destroy",
            "desc": "Cleans up the ObservableCountingMap and sets the metatable to nil.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 322,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "KeyAdded",
            "desc": "Fires when an key is added",
            "lua_type": "Signal<T>",
            "readonly": true,
            "source": {
                "line": 37,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "KeyRemoved",
            "desc": "Fires when an key is removed.",
            "lua_type": "Signal<T>",
            "readonly": true,
            "source": {
                "line": 45,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "KeyChanged",
            "desc": "Fires when an item count changes",
            "lua_type": "Signal<T>",
            "readonly": true,
            "source": {
                "line": 53,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "CountChanged",
            "desc": "Fires when the total count changes.",
            "lua_type": "RBXScriptSignal",
            "source": {
                "line": 60,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        }
    ],
    "types": [],
    "name": "ObservableCountingMap",
    "desc": "An observable map that counts up/down and removes when the count is zero.",
    "source": {
        "line": 5,
        "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
    }
}