Skip to main content

ObservableSet

A list that can be observed for blend and other components

Properties

ItemAdded

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

Fires when an item is added

ItemRemoved

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

Fires when an item is removed.

CountChanged

ObservableSet.CountChanged: RBXScriptSignal

Fires when the count changes.

Functions

new

ObservableSet.new() → ObservableSet<T>

Constructs a new ObservableSet

isObservableSet

ObservableSet.isObservableSet(valueany) → boolean

Returns whether the value is an observable set

ObserveItemsBrio

ObservableSet:ObserveItemsBrio() → Observable<Brio<T>>

Observes all items in the set

ObserveContains

ObservableSet:ObserveContains(itemT) → Observable<boolean>

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.

Contains

ObservableSet:Contains(itemT) → boolean

Returns whether the set contains the item

GetCount

ObservableSet:GetCount() → number

Gets the count of items in the set

ObserveCount

ObservableSet:ObserveCount() → Observable<number>

Observes the count of the set

Add

ObservableSet:Add(itemT) → callback--

Call to remove

Adds the item to the set if it does not exists.

Remove

ObservableSet:Remove(itemT) → ()

Removes the item from the set if it exists.

GetFirstItem

ObservableSet:GetFirstItem() → T

Gets an arbitrary item in the set (not guaranteed to be ordered)

GetList

ObservableSet:GetList() → {T}

Gets a list of all entries.

GetSetCopy

ObservableSet:GetSetCopy() → {[T]true}

Gets a copy of the set

GetRawSet

ObservableSet:GetRawSet() → {[T]true}

Gets the raw set. Do not modify this set.

Destroy

ObservableSet:Destroy() → ()

Cleans up the ObservableSet and sets the metatable to nil.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructs a new ObservableSet",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "ObservableSet<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 24,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "isObservableSet",
            "desc": "Returns whether the value is an observable set",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 64,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "ObserveItemsBrio",
            "desc": "Observes all items in the set",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<T>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 72,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "ObserveContains",
            "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": "item",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<boolean>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 112,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "Contains",
            "desc": "Returns whether the set contains the item",
            "params": [
                {
                    "name": "item",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 147,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "GetCount",
            "desc": "Gets the count of items in the set",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 157,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "ObserveCount",
            "desc": "Observes the count of the set",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<number>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 165,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "Add",
            "desc": "Adds the item to the set if it does not exists.",
            "params": [
                {
                    "name": "item",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "Call to remove",
                    "lua_type": "callback"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 174,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "Remove",
            "desc": "Removes the item from the set if it exists.",
            "params": [
                {
                    "name": "item",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 197,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "GetFirstItem",
            "desc": "Gets an arbitrary item in the set (not guaranteed to be ordered)",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 216,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "GetList",
            "desc": "Gets a list of all entries.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ T }"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 225,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "GetSetCopy",
            "desc": "Gets a copy of the set",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [T]: true }"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 237,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "GetRawSet",
            "desc": "Gets the raw set. Do not modify this set.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [T]: true }"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 245,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "Destroy",
            "desc": "Cleans up the ObservableSet and sets the metatable to nil.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 253,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "ItemAdded",
            "desc": "Fires when an item is added",
            "lua_type": "Signal<T>",
            "readonly": true,
            "source": {
                "line": 39,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "ItemRemoved",
            "desc": "Fires when an item is removed.",
            "lua_type": "Signal<T>",
            "readonly": true,
            "source": {
                "line": 47,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "CountChanged",
            "desc": "Fires when the count changes.",
            "lua_type": "RBXScriptSignal",
            "source": {
                "line": 54,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        }
    ],
    "types": [],
    "name": "ObservableSet",
    "desc": "A list that can be observed for blend and other components",
    "source": {
        "line": 5,
        "path": "src/observablecollection/src/Shared/ObservableSet.lua"
    }
}