FollowAttribute
Tracks attribute changes and propagates updated userdata to states.
Type | Since | Scoped |
---|---|---|
Declaration | 0.0.3 | No |
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