Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

4O4/lua-reactivex

Repository files navigation

Reactive Extensions for Lua.

Lua-ReactiveX 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.

This is a friendly fork of RxLua. All credits for initial development go to the original author, bjornbytes.

This fork includes some fixes and features contributed by the community. There are also foundational changes here in order to introduce a proper automatic unsubscription mechanism which was missing and caused unexpected behavior in some cases. These changes are heavily inspired by the RxJS (5.x) internals, and thus RxJS is considered a reference implementation for all future development of Lua-ReactiveX.

Getting Started

Lua

Install with luarocks:

luarocks install reactivex

Or download a portable package from the Releases page, and extract reactivex.lua file into your project. Then simply require it:

local rx = require("reactivex")

Luvit

Install using lit:

lit install 4O4/reactivex

Then require it:

local rx = require("reactivex")

Love2D

See RxLove.

Example Usage

Use ReactiveX to construct a simple cheer:

local rx = require("reactivex")
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 for more.

Resources

Tests

Uses lust. Run with:

lua tests/runner.lua

or, to run a specific test:

lua tests/runner.lua skipUntil

License

MIT

About

Reactive Extensions for Lua

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages

  • Lua 100.0%

AltStyle によって変換されたページ (->オリジナル) /