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(value: any) → boolean

Returns whether the value is an observable set

iterating over ObservableSet​

for  (T) → (
(
T,
nextIndex: any
) → ...any,
T?
) 
 in  ObservableSet  do

Allows iteration over the observable set

ObserveItemsBrio​

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

Observes all items in the set

ObserveContains​

ObservableSet.ObserveContains(
self: ObservableSet<T>,
item: T
) → 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(
self: ObservableSet<T>,
item: T
) → boolean

Returns whether the set contains the item

GetCount​

ObservableSet.GetCount(self: ObservableSet<T>) → number

Gets the count of items in the set

ObserveCount​

ObservableSet.ObserveCount(self: ObservableSet<T>) → Observable<number>

Observes the count of the set

Add​

ObservableSet.Add(
self: ObservableSet<T>,
item: T
) → callback--

Call to remove

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

Remove​

ObservableSet.Remove(
self: ObservableSet<T>,
item: T
) → Trueifremoved

Removes the item from the set if it exists.

GetFirstItem​

ObservableSet.GetFirstItem(self: ObservableSet<T>) → T

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

GetList​

ObservableSet.GetList(self: ObservableSet<T>) → {T}

Gets a list of all entries.

GetSetCopy​

ObservableSet.GetSetCopy(self: ObservableSet<T>) → {[T]: true}

Gets a copy of the set

GetRawSet​

ObservableSet.GetRawSet(self: ObservableSet<T>) → {[T]: true}

Gets the raw set. Do not modify this set.

Destroy​

ObservableSet.Destroy(self: ObservableSet<T>) → ()

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": 39,
                "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": 79,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "__iter",
            "desc": "Allows iteration over the observable set",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableSet<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(T) -> ((T, nextIndex: any) -> ...any, T?)"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 88,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "ObserveItemsBrio",
            "desc": "Observes all items in the set",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableSet<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<T>>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 96,
                "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": "self",
                    "desc": "",
                    "lua_type": "ObservableSet<T>"
                },
                {
                    "name": "item",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<boolean>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 150,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "Contains",
            "desc": "Returns whether the set contains the item",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableSet<T>"
                },
                {
                    "name": "item",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 185,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "GetCount",
            "desc": "Gets the count of items in the set",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableSet<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 195,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "ObserveCount",
            "desc": "Observes the count of the set",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableSet<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<number>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 205,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "Add",
            "desc": "Adds the item to the set if it does not exists.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableSet<T>"
                },
                {
                    "name": "item",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "Call to remove",
                    "lua_type": "callback"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 214,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "Remove",
            "desc": "Removes the item from the set if it exists.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableSet<T>"
                },
                {
                    "name": "item",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "True if removed"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 238,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "GetFirstItem",
            "desc": "Gets an arbitrary item in the set (not guaranteed to be ordered)",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableSet<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 260,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "GetList",
            "desc": "Gets a list of all entries.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableSet<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ T }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 269,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "GetSetCopy",
            "desc": "Gets a copy of the set",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableSet<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [T]: true }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 281,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "GetRawSet",
            "desc": "Gets the raw set. Do not modify this set.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableSet<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [T]: true }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 289,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "Destroy",
            "desc": "Cleans up the ObservableSet and sets the metatable to nil.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "ObservableSet<T>"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 296,
                "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": 54,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "ItemRemoved",
            "desc": "Fires when an item is removed.",
            "lua_type": "Signal<T>",
            "readonly": true,
            "source": {
                "line": 62,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        },
        {
            "name": "CountChanged",
            "desc": "Fires when the count changes.",
            "lua_type": "RBXScriptSignal",
            "source": {
                "line": 69,
                "path": "src/observablecollection/src/Shared/ObservableSet.lua"
            }
        }
    ],
    "types": [],
    "name": "ObservableSet",
    "desc": "A list that can be observed for blend and other components",
    "source": {
        "line": 6,
        "path": "src/observablecollection/src/Shared/ObservableSet.lua"
    }
}