Skip to main content

ObservableMapList

Holds a map of lists. This is good for list-based

Functions

new

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

Constructs a new ObservableMapList

Push

ObservableMapList:Push(
observeKeyObservable<TKey>,
entryTValue
) → MaidTask--

Cleanup object that will remove the entry

Adds an entry with a dynamic key. This is great for caching things that need to be looked up by key.

tip

If observeKey emits nil then the value will be excluded from the list.

GetFirstItemForKey

ObservableMapList:GetFirstItemForKey(keyTKey) → TValue | nil

Gets the first item for the given key

GetItemForKeyAtIndex

ObservableMapList:GetItemForKeyAtIndex(
keyTKey,
indexnumber
) → TValue | nil

Gets the item for the given key at the index

mapList:Push("fruits", "apple")
mapList:Push("fruits", "orange")
mapList:Push("fruits", "banana")

-- Print the last item
print(mapList:GetItemForKeyAtIndex("fruits", -1)) ==> banana

GetListCount

ObservableMapList:GetListCount() → number

Gets how many lists exist

ObserveListCount

ObservableMapList:ObserveListCount() → Observable<number>

Observes how many lists exist

GetAtListIndex

ObservableMapList:GetAtListIndex(
keyTKey,
indexnumber
) → Observable<TValue?>

Gets the current value at the list index

ObserveAtListIndex

ObservableMapList:ObserveAtListIndex(
keyTKey,
indexnumber
) → Observable<TValue?>

Observes the current value at the index

GetKeyList

ObservableMapList:GetKeyList() → {TKey}

Gets a list of all keys

ObserveKeyList

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

Observes the list of all keys.

ObserveKeysBrio

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

Observes all keys in the map

ObserveAtListIndexBrio

ObservableMapList:ObserveAtListIndexBrio(
keyTKey,
indexnumber
) → Observable<Brio<TValue>>

Observes the current value at the index

ObserveItemsForKeyBrio

ObservableMapList:ObserveItemsForKeyBrio(keyTKey) → Observable<Brio<TValue>>

Observes all items at the given key

GetListFromKey

ObservableMapList:GetListFromKey(keyTKey) → {TValue}

Gets a list for a given key.

GetListForKey

ObservableMapList:GetListForKey(keyTKey) → ObservableList<TValue>

Gets the observable list for the given key

GetListOfValuesAtListIndex

ObservableMapList:GetListOfValuesAtListIndex(indexnumber) → ObservableList<TValue>

Gets a list of all of the entries at the given index, if it exists

ObserveList

ObservableMapList:ObserveList(keyTKey) → Observable<ObservableList<TValue>>

Observes the observable list for the given key

ObserveListBrio

ObservableMapList:ObserveListBrio(keyTKey) → Observable<Brio<ObservableList<TValue>>>

Observes the observable list for the given key

ObserveCountForKey

ObservableMapList:ObserveCountForKey(keyTKey) → Observable<number>

Observes the number of entries for the given key

Destroy

ObservableMapList:Destroy() → ()

Cleans up the ObservableMapList and sets the metatable to nil.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructs a new ObservableMapList",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "ObservableMapList<TKey, TValue>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 24,
                "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
            }
        },
        {
            "name": "Push",
            "desc": "Adds an entry with a dynamic key. This is great for caching things\nthat need to be looked up by key.\n\n:::tip\nIf `observeKey` emits nil then the value will be excluded from the list.\n:::",
            "params": [
                {
                    "name": "observeKey",
                    "desc": "",
                    "lua_type": "Observable<TKey>"
                },
                {
                    "name": "entry",
                    "desc": "",
                    "lua_type": "TValue"
                }
            ],
            "returns": [
                {
                    "desc": "Cleanup object that will remove the entry",
                    "lua_type": "MaidTask"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 68,
                "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
            }
        },
        {
            "name": "GetFirstItemForKey",
            "desc": "Gets the first item for the given key",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "TKey"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "TValue | nil"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 101,
                "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
            }
        },
        {
            "name": "GetItemForKeyAtIndex",
            "desc": "Gets the item for the given key at the index\n\n```\nmapList:Push(\"fruits\", \"apple\")\nmapList:Push(\"fruits\", \"orange\")\nmapList:Push(\"fruits\", \"banana\")\n\n-- Print the last item\nprint(mapList:GetItemForKeyAtIndex(\"fruits\", -1)) ==> banana\n```",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "TKey"
                },
                {
                    "name": "index",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "TValue | nil"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 128,
                "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
            }
        },
        {
            "name": "GetListCount",
            "desc": "Gets how many lists exist",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 145,
                "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
            }
        },
        {
            "name": "ObserveListCount",
            "desc": "Observes how many lists exist",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<number>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 154,
                "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
            }
        },
        {
            "name": "GetAtListIndex",
            "desc": "Gets the current value at the list index",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "TKey"
                },
                {
                    "name": "index",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<TValue?>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 165,
                "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
            }
        },
        {
            "name": "ObserveAtListIndex",
            "desc": "Observes the current value at the index",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "TKey"
                },
                {
                    "name": "index",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<TValue?>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 184,
                "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
            }
        },
        {
            "name": "GetKeyList",
            "desc": "Gets a list of all keys",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ TKey }"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 204,
                "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
            }
        },
        {
            "name": "ObserveKeyList",
            "desc": "Observes the list of all keys.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<{ TKey }>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 212,
                "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
            }
        },
        {
            "name": "ObserveKeysBrio",
            "desc": "Observes all keys in the map",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<TKey>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 220,
                "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
            }
        },
        {
            "name": "ObserveAtListIndexBrio",
            "desc": "Observes the current value at the index",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "TKey"
                },
                {
                    "name": "index",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<TValue>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 231,
                "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
            }
        },
        {
            "name": "ObserveItemsForKeyBrio",
            "desc": "Observes all items at the given key",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "TKey"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<TValue>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 252,
                "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
            }
        },
        {
            "name": "GetListFromKey",
            "desc": "Gets a list for a given key.",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "TKey"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ TValue }"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 272,
                "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
            }
        },
        {
            "name": "GetListForKey",
            "desc": "Gets the observable list for the given key",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "TKey"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "ObservableList<TValue>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 288,
                "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
            }
        },
        {
            "name": "GetListOfValuesAtListIndex",
            "desc": "Gets a list of all of the entries at the given index, if it exists",
            "params": [
                {
                    "name": "index",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "ObservableList<TValue>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 300,
                "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
            }
        },
        {
            "name": "ObserveList",
            "desc": "Observes the observable list for the given key",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "TKey"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<ObservableList<TValue>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 321,
                "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
            }
        },
        {
            "name": "ObserveListBrio",
            "desc": "Observes the observable list for the given key",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "TKey"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<ObservableList<TValue>>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 333,
                "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
            }
        },
        {
            "name": "ObserveCountForKey",
            "desc": "Observes the number of entries for the given key",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "TKey"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<number>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 345,
                "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
            }
        },
        {
            "name": "Destroy",
            "desc": "Cleans up the ObservableMapList and sets the metatable to nil.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 385,
                "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "ObservableMapList",
    "desc": "Holds a map of lists. This is good for list-based",
    "source": {
        "line": 6,
        "path": "src/observablecollection/src/Shared/ObservableMapList.lua"
    }
}