Skip to main content

ObservableCountingMap

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

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(selfObservableCountingMap<T>) → Observable<{T}>

Observes the current set of active keys

ObserveKeysSet

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

Observes the current set of active keys

ObservePairsBrio

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

Observes all keys in the map

ObserveAtKey

ObservableCountingMap.ObserveAtKey(
keyTKey
) → Observable<number>

Observes the value for the given key.

ObserveKeysBrio

ObservableCountingMap.ObserveKeysBrio(selfObservableCountingMap<T>) → 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(selfObservableCountingMap<T>) → number

Gets the count of keys in the map

ObserveTotalKeyCount

ObservableCountingMap.ObserveTotalKeyCount(selfObservableCountingMap<T>) → 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(selfObservableCountingMap<T>) → T

Gets the first key

GetKeyList

ObservableCountingMap.GetKeyList(selfObservableCountingMap<T>) → {T}

Gets a list of all keys.

Destroy

ObservableCountingMap.Destroy(selfObservableCountingMap<T>) → ()

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": 67,
                "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": 89,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "__iter",
            "desc": "Allows iteration over the observable counting map",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableCountingMap<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(T) -> ((T, nextIndex: any) -> ...any, T?)"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 98,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "ObserveKeysList",
            "desc": "Observes the current set of active keys",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableCountingMap<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<{ T }>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 106,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "ObserveKeysSet",
            "desc": "Observes the current set of active keys",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableCountingMap<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<{ [T]: true }>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 122,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "ObservePairsBrio",
            "desc": "Observes all keys in the map",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableCountingMap<T>\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<(T, number)>>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 164,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "ObserveAtKey",
            "desc": "Observes the value for the given key.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableCountingMap<T>"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "TKey"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<number>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 203,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "ObserveKeysBrio",
            "desc": "Observes all keys in the map",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableCountingMap<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<T>>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 215,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "Contains",
            "desc": "Returns whether the map contains the key",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableCountingMap<T>"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 255,
                "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": "self",
                    "desc": "",
                    "lua_type": "ObservableCountingMap<T>"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 266,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "GetTotalKeyCount",
            "desc": "Gets the count of keys in the map",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableCountingMap<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 276,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "ObserveTotalKeyCount",
            "desc": "Observes the count of the keys in the map",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableCountingMap<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<number>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 286,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "Set",
            "desc": "Sets the current value",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableCountingMap<T>"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "T"
                },
                {
                    "name": "amount",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "callback"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 296,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "Add",
            "desc": "Adds the key to the map if it does not exists.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableCountingMap<T>"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "T"
                },
                {
                    "name": "amount",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "callback"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 313,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "Remove",
            "desc": "Removes the key from the set if it exists.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableCountingMap<T>"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "T"
                },
                {
                    "name": "amount",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "callback"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 379,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "GetFirstKey",
            "desc": "Gets the first key",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableCountingMap<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 390,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "GetKeyList",
            "desc": "Gets a list of all keys.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableCountingMap<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ T }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 399,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        },
        {
            "name": "Destroy",
            "desc": "Cleans up the ObservableCountingMap and sets the metatable to nil.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableCountingMap<T>"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 410,
                "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "ObservableCountingMap",
    "desc": "An observable map that counts up/down and removes when the count is zero.",
    "source": {
        "line": 6,
        "path": "src/observablecollection/src/Shared/ObservableCountingMap.lua"
    }
}