https://github.com/bjornbytes/RxLua
Reactive Extensions for Lua
https://github.com/bjornbytes/RxLua
Last synced: 5 months ago
JSON representation
Reactive Extensions for Lua
- Host: GitHub
- URL: https://github.com/bjornbytes/RxLua
- Owner: bjornbytes
- License: mit
- Created: 2015-07-15T07:40:30.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2020-06-21T03:32:15.000Z (about 5 years ago)
- Last Synced: 2025-02-04T23:34:24.821Z (5 months ago)
- Language: Lua
- Homepage:
- Size: 312 KB
- Stars: 524
- Watchers: 31
- Forks: 75
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-defold - RxLua
README
RxLua [](https://travis-ci.org/bjornbytes/RxLua) [](https://coveralls.io/github/bjornbytes/RxLua?branch=master)
===[Reactive Extensions](http://reactivex.io) for Lua.
RxLua gives Lua the power of Observables, which are data structures that represent a stream of values that arrive over time. They're very handy when dealing with events, streams of data, asynchronous requests, and concurrency.
Getting Started
---#### Lua
Copy the `rx.lua` file into your project and require it:
```lua
local rx = require 'rx'
```You can also install RxLua using luarocks:
```sh
luarocks install bjornbytes/rxlua
```#### Luvit
Install using `lit`:
```sh
lit install bjornbytes/rx
```Then require it:
```lua
local rx = require 'rx'
```#### Love2D
See [RxLove](https://github.com/bjornbytes/RxLove).
Example Usage
---Use RxLua to construct a simple cheer:
```lua
local Rx = require 'rx'Rx.Observable.fromRange(1, 8)
:filter(function(x) return x % 2 == 0 end)
:concat(Rx.Observable.of('who do we appreciate'))
:map(function(value) return value .. '!' end)
:subscribe(print)-- => 2! 4! 6! 8! who do we appreciate!
```See [examples](examples) for more.
Resources
---- [Documentation](doc)
- [Contributor Guide](doc/CONTRIBUTING.md)
- [Rx Introduction](http://reactivex.io/intro.html)Tests
---Uses [lust](https://github.com/bjornbytes/lust). Run with:
```
lua tests/runner.lua
```or, to run a specific test:
```
lua tests/runner.lua skipUntil
```License
---MIT, see [`LICENSE`](LICENSE) for details.