Home › Overview › MainModule › Flux
State
Constructors: State.new · State.compute · Spring.new · Tween.new
Types
StateData type
luau
type StateData<T> = {
_binds: { [T]: any },
_bindConnection: RBXScriptConnection?,
_boundChildren: { Instance? },
_boundChildrenLayoutOrder: number?,
_boundParent: Instance?,
_connections: Type.Dict<Type.Function>,
_computation: Type.Function?,
_dependencies: Type.Set<State<T>>,
_dependents: Type.Set<State<T>>,
_tweenInfo: (TweenInfo | any)?,
_tweenInit: any?,
_tweenGoal: any?,
_tweenStart: any?,
_tweenRepeat: number?,
_value: T,
}State type
luau
type State<T> = typeof(setmetatable({} :: StateData<T>, State))Stateful type
luau
type Stateful<T> = T | State<T>Properties
deferUpdates
luau
State.deferUpdates: booleanFunctions
isState
luau
State.isState(object: any): booleanChecks if an object is a Flux state
raw
luau
State.raw<T>(object: T): anyGets the raw value of a Flux state or returns the input if it's not a state
rawVariadic
luau
State.rawVariadic(...: any): ...anyGets the raw values of multiple Flux states or non-state inputs
new
compute
luau
State.compute<T>(computation: () -> T): State<T>Creates a computed state, automatically tracking dependencies
Methods
Connect
luau
State:Connect(callback: Type.Function): Type.FunctionAdds a hook callback function to be called when the state changes
Destroy
luau
State:Destroy()Destroys the state, clearing all dependencies and bindings