Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Roblox/rodux
A state management library for Roblox Lua inspired by Redux
https://github.com/Roblox/rodux
lua redux roblox state
Last synced: about 2 months ago
JSON representation
A state management library for Roblox Lua inspired by Redux
- Host: GitHub
- URL: https://github.com/Roblox/rodux
- Owner: Roblox
- License: apache-2.0
- Created: 2017-10-11T18:37:04.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-03-23T17:09:10.000Z (9 months ago)
- Last Synced: 2024-09-21T20:39:50.160Z (3 months ago)
- Topics: lua, redux, roblox, state
- Language: Lua
- Homepage: https://roblox.github.io/rodux
- Size: 1.5 MB
- Stars: 250
- Watchers: 25
- Forks: 57
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-roblox - Rodux
README
Rodux
## Installation
### Method 1: Model File (Roblox Studio)
* Download the `rbxm` model file attached to the latest release from the [GitHub releases page](https://github.com/Roblox/rodux/releases).
* Insert the model into Studio into a place like `ReplicatedStorage`### Method 2: Filesystem
* Copy the `src` directory into your codebase
* Rename the folder to `Rodux`
* Use a plugin like [Rojo](https://github.com/LPGhatguy/rojo) to sync the files into a place## Usage
Rodux works just like [Redux](https://redux.js.org)'s base API.See the official [Rodux Documentation](https://roblox.github.io/rodux/) for more details.
```lua
local Rodux = require(script.Parent.Rodux)local function reducer(state, action)
state = state or {
frobulations = 0,
}if action.type == "frobulate" then
return {
frobulations = state.frobulations + 1,
}
endreturn state
endlocal store = Rodux.Store.new(reducer)
store:getState() -- { frobulations = 0 }
store:dispatch({
type = "frobulate",
})store:getState() -- { frobulations = 1 }
```## Contributing
Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for information.## License
Rodux is available under the Apache 2.0 license. See [LICENSE](LICENSE) for details.