Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joshtynjala/signal.lua
Signals are a light-weight messaging tools for Lua and the Corona SDK.
https://github.com/joshtynjala/signal.lua
lua signals
Last synced: 4 months ago
JSON representation
Signals are a light-weight messaging tools for Lua and the Corona SDK.
- Host: GitHub
- URL: https://github.com/joshtynjala/signal.lua
- Owner: joshtynjala
- Archived: true
- Created: 2011-03-26T19:42:38.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2011-04-27T21:07:55.000Z (over 13 years ago)
- Last Synced: 2024-05-01T19:33:48.088Z (9 months ago)
- Topics: lua, signals
- Language: Lua
- Homepage:
- Size: 91.8 KB
- Stars: 15
- Watchers: 5
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: readme.textile
Awesome Lists containing this project
README
h1. signal.lua
A simple implementation of Signals for Lua and Ansca's Corona SDK by "Josh Tynjala":http://twitter.com/joshtynjala. Inspired by "as3-signals":https://github.com/robertpenner/as3-signals, the ActionScript implementation by "Robert Penner":http://twitter.com/robpenner.
h2. Usage
bc.. local signal = require("signal")
local function onSignalListener(message)
-- prints "signal says: hello! nil"
print("signal says:", message, self)
endlocal myTable = {}
function myTable:method(message)
-- prints "signal says: hello! table: ########"
print("signal says:", message, self)
endlocal onSignal = signal.new()
onSignal:add(onSignalListener) --no scope
onSignal:add(myTable.method, myTable) --include scope
onSignal:dispatch("hello!")