AttributeGroup
Groups of Roblox Instance attributes that share a common prefix. Useful
for creating property tables such as Dismounts in Dismounters.
Functions
Section titled “Functions”__call
Section titled “__call”function AttributeGroup.__call( self: AttributeGroup<T>, instance: Instance): std.Map<string, T>Syntax sugar for AttributeGroup:get(instance).
Parameters
Section titled “Parameters”self : AttributeGroup<T>
Section titled “self : AttributeGroup<T>”The attribute.
instance : Instance
Section titled “instance : Instance”The instance to get the attribute from.
Returns
Section titled “Returns”std.Map<string, T>
Section titled “std.Map<string, T>”All values.`
__tostring
Section titled “__tostring”function AttributeGroup.__tostring(self: AttributeGroup<T>): stringMetamethod to transform the option into a string.
Parameters
Section titled “Parameters”self : AttributeGroup<T>
Section titled “self : AttributeGroup<T>”The attribute to stringify.
Returns
Section titled “Returns”string
Section titled “string”The string representation of the attribute.`
changed
Section titled “changed”function AttributeGroup.changed( self: AttributeGroup<T>, instance: Instance, callback: (key: string, value: T) -> ()): RBXScriptConnectionConnects a callback function to be invoked when any of the attributes
tracked by this AttributeGroup change on an instance.
The callback will receive the extracted key and the new value of the changed
attribute.
Parameters
Section titled “Parameters”self : AttributeGroup<T>
Section titled “self : AttributeGroup<T>”The attribute.
instance : Instance
Section titled “instance : Instance”The instance to track the attribute.
callback : (key: string, value: T) -> ()
Section titled “callback : (key: string, value: T) -> ()”A function to call when a relevant attribute changes, receiving the key and the new value.
Returns
Section titled “Returns”RBXScriptConnection
Section titled “RBXScriptConnection”Can be used to disconnect the callback.`
function AttributeGroup.get( self: AttributeGroup<T>, instance: Instance): std.Map<string, T>Returns all values with from attributes with the given prefix from the given
instance. If config.typecheck is enabled, values are checked against the
attribute’s type.
Parameters
Section titled “Parameters”self : AttributeGroup<T>
Section titled “self : AttributeGroup<T>”The attribute.
instance : Instance
Section titled “instance : Instance”The instance to get the attribute from.
Returns
Section titled “Returns”std.Map<string, T>
Section titled “std.Map<string, T>”All values.`