|
@@ -3,32 +3,63 @@ RxLua [](https://trav
|
|
|
|
|
|
[Reactive Extensions](http://reactivex.io) for Lua.
|
|
[Reactive Extensions](http://reactivex.io) for Lua.
|
|
|
|
|
|
-Examples
|
|
|
|
|
|
+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
|
|
---
|
|
---
|
|
|
|
|
|
-Cheer someone on using functional reactive programming:
|
|
|
|
|
|
+#### Lua
|
|
|
|
+
|
|
|
|
+Copy the `rx.lua` file into your project and require it:
|
|
|
|
+
|
|
|
|
+```lua
|
|
|
|
+local rx = require 'rx'
|
|
|
|
+```
|
|
|
|
+
|
|
|
|
+#### 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
|
|
```lua
|
|
local Rx = require 'rx'
|
|
local Rx = require 'rx'
|
|
|
|
|
|
-Rx.Observable.fromRange(1, 4)
|
|
|
|
- :map(function(x) return x * 2 end)
|
|
|
|
|
|
+Rx.Observable.fromRange(1, 8)
|
|
|
|
+ :filter(function(x) return x % 2 == 0 end)
|
|
:concat(Rx.Observable.fromValue('who do we appreciate'))
|
|
:concat(Rx.Observable.fromValue('who do we appreciate'))
|
|
:map(function(value) return value .. '!' end)
|
|
:map(function(value) return value .. '!' end)
|
|
:subscribe(print)
|
|
:subscribe(print)
|
|
|
|
+
|
|
|
|
+-- => 2! 4! 6! 8! who do we appreciate!
|
|
```
|
|
```
|
|
|
|
|
|
See [examples](examples) for more.
|
|
See [examples](examples) for more.
|
|
|
|
|
|
-Documentation
|
|
|
|
|
|
+Resources
|
|
---
|
|
---
|
|
|
|
|
|
-See [here](doc).
|
|
|
|
-
|
|
|
|
-Contributing
|
|
|
|
----
|
|
|
|
-
|
|
|
|
-See [here](doc/CONTRIBUTING.md).
|
|
|
|
|
|
+- [Documentation](doc)
|
|
|
|
+- [Contributor Guide](doc/CONTRIBUTING.md)
|
|
|
|
+- [Trello board](https://trello.com/b/Q9dJicKK)
|
|
|
|
+- [Rx Introduction](http://reactivex.io/intro.html)
|
|
|
|
|
|
Tests
|
|
Tests
|
|
---
|
|
---
|
|
@@ -45,12 +76,6 @@ or, to run a specific test:
|
|
lua tests/runner.lua skipUntil
|
|
lua tests/runner.lua skipUntil
|
|
```
|
|
```
|
|
|
|
|
|
-Related
|
|
|
|
----
|
|
|
|
-
|
|
|
|
-- [Trello](https://trello.com/b/Q9dJicKK)
|
|
|
|
-- [RxLove](https://github.com/bjornbytes/RxLove)
|
|
|
|
-
|
|
|
|
License
|
|
License
|
|
---
|
|
---
|
|
|
|
|