Value ¶
export type Value<T> = StateObject<T> & {
kind: "State",
set: (self, newValue: T) -> (),
timeliness: "lazy"
}
A specialised state object which allows regular Luau code to control its value.
Non-standard type syntax
The above type definition uses self
to denote methods. At time of writing,
Luau does not interpret self
specially.
Members¶
kind : "Value" ¶
A more specific type string which can be used for runtime type checking. This can be used to tell types of state object apart.
Methods¶
set -> T ¶
function Value:set(
newValue: T
): T
Updates the value of this state object. Other objects using the value are notified of the change.
The newValue
is always returned, so that :set()
can be used to capture
values inside of expressions.