search/
Start typing to search packages!
package_2
signals
By @post-ill
Roblox
Mirroredsignal
signal is a generic, simple signal library for Roblox.
Installation
signal is available on wally, so on pesde. You can also just go to the latest release, pick the script and drop it into your project!
Usage
local signal = require(path.to.signal)
local sig = signal.new()
sig:connect(function()
print("Hey!")
end)
sig:fire()
API
1. Signal
Class
| field | description |
|---|---|
signal.new | creates a signal |
signal.check(v) | validates if v argument is a signal |
signal.connection | holds the connection class |
Instance
| field | description |
|---|---|
signal:connect(fn) | binds fn callback to be executed on every signal:fire and returns a connection |
signal:once(fn) | binds fn callback to be executed and dropped on the next signal:fire and returns a connection |
signal:wait | yields until the next signal:fire and returns the fired data |
signal:fire(...v) | calls every connection made passing ...v data |
signal:disconnectAll | drop every connection made |
2. Connection
Class
| field | description |
|---|---|
connection.check(v) | validates if v argument is a connection |
Instance
| field | description |
|---|---|
connection.connected | indicates if the connection is still alive |
connection:disconnect | drop the connection from the origin signal |
Examples
local sig: signal.Signal<number, string> = signal.new()
local manualOnce = sig:connect(function(id, type)
print(id, type)
end)
sig:connect(function(id, type)
print(id, type)
end)
sig:once(function(id, type)
-- Use on the next fire
end)
task.defer(function()
sig:fire()
end)
local id, type = sig:wait()
manualOnce:disconnect()
sig:fire()
sig:fire()
sig:disconnectAll()
Issues
Feel free to open an issue if you find out that the library is not behaving as expected.
Package Details
Install command (Click to copy)
Version
1.0.0
License
Unlicense
Safe for commercial use
The package archive does not include its license text; the license is declared in its manifest metadata.
Automated license review — not legal advice.
