Skip to main content

ObservableList

A list that can be observed for blend and other components

Functions

new

ObservableList.new() → ObservableList<T>

Constructs a new ObservableList

isObservableList

ObservableList.isObservableList(valueany) → boolean

Returns whether the value is an observable list

Observe

ObservableList.Observe(selfObservableList<T>) → Observable<{T}>

Observes the list, allocating a new list in the process.

iterating over ObservableList

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

Allows iteration over the observable map

ObserveItemsBrio

ObservableList.ObserveItemsBrio(selfObservableList<T>) → Observable<Brio<T>>

Observes all items in the list

ObserveIndex

ObservableList.ObserveIndex(
selfObservableList<T>,
indexToObservenumber
) → Observable<number?>

Observes the index as it changes, until the entry at the existing index is removed.

ObserveAtIndex

ObservableList.ObserveAtIndex(
selfObservableList<T>,
indexToObservenumber
) → Observable<T?>

Observes the current value at a given index. This can be useful for observing the first entry, or matching stuff up to a given slot.

list:ObserveAtIndex(1):Subscribe(print) --> prints first item
list:ObserveAtIndex(-1):Subscribe(print) --> prints last item

ObserveAtIndexBrio

ObservableList.ObserveAtIndexBrio(
selfObservableList<T>,
indexToObservenumber
) → Observable<Brio<T>>

Observes the current value at a given index. This can be useful for observing the first entry, or matching stuff up to a given slot.

RemoveFirst

ObservableList.RemoveFirst(
selfObservableList<T>,
valueT
) → boolean

Removes the first instance found in contents

GetCountValue

ObservableList.GetCountValue(selfObservableList<T>) → ValueObject<number>

Returns an ValueObject that represents the CountValue

ObserveIndexByKey

ObservableList.ObserveIndexByKey(
selfObservableList<T>,
keySymbol
) → Observable<number?>

Observes the index as it changes, until the entry at the existing key is removed.

GetIndexByKey

ObservableList.GetIndexByKey(
selfObservableList<T>,
keySymbol
) → number?

Gets the current index from the key

GetCount

ObservableList.GetCount(selfObservableList<T>) → number

Gets the count of items in the list

ObserveCount

ObservableList.ObserveCount(selfObservableList<T>) → Observable<number>

Observes the count of the list

Add

ObservableList.Add(
selfObservableList<T>,
itemT
) → callback--

Call to remove

Adds the item to the list at the specified index

Get

ObservableList.Get(
selfObservableList<T>,
indexnumber
) → T?

Gets the current item at the index, or nil if it is not defined.

InsertAt

ObservableList.InsertAt(
selfObservableList<T>,
itemT,
indexnumber?
) → callback--

Call to remove

Adds the item to the list at the specified index

RemoveAt

ObservableList.RemoveAt(
selfObservableList<T>,
indexnumber
) → T

Removes the item at the index

RemoveByKey

ObservableList.RemoveByKey(
selfObservableList<T>,
keySymbol
) → T

Removes the item from the list if it exists.

GetList

ObservableList.GetList(selfObservableList<T>) → {T}

Gets a list of all entries.

Destroy

ObservableList.Destroy(selfObservableList<T>) → ()

Cleans up the ObservableList and sets the metatable to nil.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructs a new ObservableList",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "ObservableList<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 65,
                "path": "src/observablecollection/src/Shared/ObservableList.lua"
            }
        },
        {
            "name": "isObservableList",
            "desc": "Returns whether the value is an observable list",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 90,
                "path": "src/observablecollection/src/Shared/ObservableList.lua"
            }
        },
        {
            "name": "Observe",
            "desc": "Observes the list, allocating a new list in the process.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableList<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<{ T }>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 99,
                "path": "src/observablecollection/src/Shared/ObservableList.lua"
            }
        },
        {
            "name": "__iter",
            "desc": "Allows iteration over the observable map",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableList<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(T) -> ((T, nextIndex: any) -> ...any, T?)"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 126,
                "path": "src/observablecollection/src/Shared/ObservableList.lua"
            }
        },
        {
            "name": "ObserveItemsBrio",
            "desc": "Observes all items in the list",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableList<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<T>>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 138,
                "path": "src/observablecollection/src/Shared/ObservableList.lua"
            }
        },
        {
            "name": "ObserveIndex",
            "desc": "Observes the index as it changes, until the entry at the existing\nindex is removed.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableList<T>"
                },
                {
                    "name": "indexToObserve",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<number?>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 174,
                "path": "src/observablecollection/src/Shared/ObservableList.lua"
            }
        },
        {
            "name": "ObserveAtIndex",
            "desc": "Observes the current value at a given index. This can be useful for observing\nthe first entry, or matching stuff up to a given slot.\n\n```\nlist:ObserveAtIndex(1):Subscribe(print) --> prints first item\nlist:ObserveAtIndex(-1):Subscribe(print) --> prints last item\n```",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableList<T>"
                },
                {
                    "name": "indexToObserve",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<T?>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 197,
                "path": "src/observablecollection/src/Shared/ObservableList.lua"
            }
        },
        {
            "name": "ObserveAtIndexBrio",
            "desc": "Observes the current value at a given index. This can be useful for observing\nthe first entry, or matching stuff up to a given slot.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableList<T>"
                },
                {
                    "name": "indexToObserve",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<T>>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 212,
                "path": "src/observablecollection/src/Shared/ObservableList.lua"
            }
        },
        {
            "name": "RemoveFirst",
            "desc": "Removes the first instance found in contents",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableList<T>"
                },
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 230,
                "path": "src/observablecollection/src/Shared/ObservableList.lua"
            }
        },
        {
            "name": "GetCountValue",
            "desc": "Returns an ValueObject that represents the CountValue",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableList<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "ValueObject<number>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 246,
                "path": "src/observablecollection/src/Shared/ObservableList.lua"
            }
        },
        {
            "name": "ObserveIndexByKey",
            "desc": "Observes the index as it changes, until the entry at the existing\nkey is removed.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableList<T>"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "Symbol"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<number?>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 257,
                "path": "src/observablecollection/src/Shared/ObservableList.lua"
            }
        },
        {
            "name": "GetIndexByKey",
            "desc": "Gets the current index from the key",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableList<T>"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "Symbol"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 271,
                "path": "src/observablecollection/src/Shared/ObservableList.lua"
            }
        },
        {
            "name": "GetCount",
            "desc": "Gets the count of items in the list",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableList<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 284,
                "path": "src/observablecollection/src/Shared/ObservableList.lua"
            }
        },
        {
            "name": "ObserveCount",
            "desc": "Observes the count of the list",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableList<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<number>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 294,
                "path": "src/observablecollection/src/Shared/ObservableList.lua"
            }
        },
        {
            "name": "Add",
            "desc": "Adds the item to the list at the specified index",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableList<T>"
                },
                {
                    "name": "item",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "Call to remove",
                    "lua_type": "callback"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 303,
                "path": "src/observablecollection/src/Shared/ObservableList.lua"
            }
        },
        {
            "name": "Get",
            "desc": "Gets the current item at the index, or nil if it is not defined.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableList<T>"
                },
                {
                    "name": "index",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "T?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 312,
                "path": "src/observablecollection/src/Shared/ObservableList.lua"
            }
        },
        {
            "name": "InsertAt",
            "desc": "Adds the item to the list at the specified index",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableList<T>"
                },
                {
                    "name": "item",
                    "desc": "",
                    "lua_type": "T"
                },
                {
                    "name": "index",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "Call to remove",
                    "lua_type": "callback"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 331,
                "path": "src/observablecollection/src/Shared/ObservableList.lua"
            }
        },
        {
            "name": "RemoveAt",
            "desc": "Removes the item at the index",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableList<T>"
                },
                {
                    "name": "index",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 390,
                "path": "src/observablecollection/src/Shared/ObservableList.lua"
            }
        },
        {
            "name": "RemoveByKey",
            "desc": "Removes the item from the list if it exists.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableList<T>"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "Symbol"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 406,
                "path": "src/observablecollection/src/Shared/ObservableList.lua"
            }
        },
        {
            "name": "GetList",
            "desc": "Gets a list of all entries.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableList<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ T }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 470,
                "path": "src/observablecollection/src/Shared/ObservableList.lua"
            }
        },
        {
            "name": "Destroy",
            "desc": "Cleans up the ObservableList and sets the metatable to nil.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableList<T>"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 481,
                "path": "src/observablecollection/src/Shared/ObservableList.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "ObservableList",
    "desc": "A list that can be observed for blend and other components",
    "source": {
        "line": 6,
        "path": "src/observablecollection/src/Shared/ObservableList.lua"
    }
}