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

iterating over ObservableCountingMap

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

Allows iteration over the 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

ObservePairsBrio

ObservableCountingMap:ObservePairsBrio() → Observable<Brio<(
T,
number
)>>

Observes all keys in the map

ObserveAtKey

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

Observes the value for the given key.

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": 24,
                "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": 72,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "__iter",
            "desc": "Allows iteration over the observable counting map",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(T) -> ((T, nextIndex: any) -> ...any, T?)"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 81,
                "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": 89,
                "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": 105,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "ObservePairsBrio",
            "desc": "Observes all keys in the map",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<(T, number)>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 144,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.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": 181,
                "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": 193,
                "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": 233,
                "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": 244,
                "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": 254,
                "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": 262,
                "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": 272,
                "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": 295,
                "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": 361,
                "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": 373,
                "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": 382,
                "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": 393,
                "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": 39,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "KeyRemoved",
            "desc": "Fires when an key is removed.",
            "lua_type": "Signal<T>",
            "readonly": true,
            "source": {
                "line": 47,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "KeyChanged",
            "desc": "Fires when an item count changes",
            "lua_type": "Signal<T>",
            "readonly": true,
            "source": {
                "line": 55,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "CountChanged",
            "desc": "Fires when the total count changes.",
            "lua_type": "RBXScriptSignal",
            "source": {
                "line": 62,
                "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"
    }
}