wiam/lightsignal
v0.2.0 ·
Lightweight signal implementation
lightsignal
lightsignal is a minimal signal implementation for the Roblox and Lune runtimes (or any Luau runtime with the task library, really),
inspired by GoodSignal, with a twist: there are no connections.
Instead, you can directly reference a signal's callbacks.
Installation
Pesde
# pesde add wiam/rl && pesde install
Wally
Add the following to your wally.toml, in the [dependencies] section:
lightsignal = "wiam77/lightsignal@<version>"
Then run:
# wally install
npm
# npm install @rbxts/lightsignal
Usage
--!strict
local lightsignal = require("path/to/rl")
local my_signal : lightsignal.signal<string> = lightsignal.new()
my_signal:connect(function(message)
print(message)
end)
my_signal:once(function(message)
print(message)
end)
task.delay(1, function()
my_signal:fire("Hello, World!")
end)
local message = my_signal:wait()
print(message)