Start typing to search packages!
lux
By @iamthebestts
Roblox
Mirroredlux
[image: Get it on Creator Store]
[image: Wally]
Lightweight reactive global state for Roblox.
Overview
lux is a small in-memory state registry for a single Roblox context.
It gives you:
- keyed state lookup
- subscriptions
- derived state
- explicit lifecycle control for computed values
Server and client registries are separate.
Install
[dependencies]
lux = "iamthebestts/lux@0.1.0"
API
lux.create
lux.create(key: string, initialValue: T): State<T>
Creates a state under key.
lux.find
lux.find(key: string): State<unknown>?
Returns the state for key, or nil.
lux.has
lux.has(key: string): boolean
Checks whether key exists.
lux.getAll
lux.getAll(): { [string]: State<unknown> }
Returns a shallow copy of the registry.
lux.computed
lux.computed(deps: { Dep }, selector: ({ unknown }) -> T): ComputedState<T>
Creates a derived state.
State
:get
state:get(): T
:set
state:set(value: T): ()
Skips dispatch when value == currentValue.
:subscribe
state:subscribe(callback: (T) -> ()): () -> ()
Returns an unsubscribe function.
:once
state:once(callback: (T) -> ()): () -> ()
Fires once, then unsubscribes.
ComputedState
ComputedState exposes:
:get():subscribe():once():destroy()
destroy() removes dependency subscriptions and stops future updates.
Contributing
See CONTRIBUTING.md.
License
This project is licensed under the terms of the MIT License
Package Details
Install command (Click to copy)
Version
0.1.0
License
MIT
Safe for commercial use
Automated license review — not legal advice.
