Skip to main content

FollowAttribute

Tracks attribute changes and propagates updated userdata to states.

TypeSinceScoped
Declaration0.0.3No

Constructor

[FollowAttribute(AttributeName : string)] = Value

Usage

Similarly to FollowProperty(), it as a constructor index; declare FollowAttribute() with a string parameter matching the attribute name you want followed, and set the value to the value you want updated.

local NumApples = Value(0)

New(MyObject, {
[FollowAttribute "Apples"] = NumApples, -- When the "Apples" attribute changes, NumApples updates
})

MyObject:SetAttribute("Apples", 5) -- Updates NumApples to 5 as well