search/
Start typing to search packages!
package_2
signal
By @nazumah
Roblox
MirroredSignal
Signal is a high-performance, type-safe implementation of the Observer pattern for Luau on Roblox. It is designed for internal communication with minimal overhead, providing advanced features like generic type support and thread-reuse optimization.
Technical Advantages
- Zero-Allocation Firing: Uses a custom task-runner to reuse coroutines, significantly reducing memory pressure under high-load event firing.
- Explicit Type System: Unlike other libraries, Signal uses explicit interface casting in its entry point. This guarantees full IntelliSense support even when installed through Wally.
- Generic Support: Fully supports Luau's variadic generics (
<T...>), ensuring that arguments passed toFireare correctly checked inConnect. - Deferred Execution: Native support for both immediate (
Fire) and engine-scheduled (FireDeferred) execution cycles.
Installation
Wally
Update your wally.toml:
[dependencies]
Signal = "nazumah/signal@1.0.4"
Quick Start
1. Basic Typed Signal
local Signal = require(path.to.Signal)
-- Create a signal with specific argument types
local onPointsChanged = Signal.new<number>()
local conn = onPointsChanged:Connect(function(newPoints: number)
print("Points updated:", newPoints)
end)
onPointsChanged:Fire(100)
conn:Disconnect()
2. Wrapping Native Events
local part = Instance.new("Part")
local onTouched = Signal.Wrap<BasePart>(part.Touched)
onTouched:Connect(function(otherPart)
print("Touched by:", otherPart.Name)
end)
Resource Management
For optimal reliability, integrate Signal with resource managers like Janitor.
local janitor = Janitor.new()
janitor:Add(onPointsChanged:Connect(onEvent), "Disconnect")
Documentation
- Why Use Signal?
- API Reference
License
Licensed under the MIT License.
Package Details
Install command (Click to copy)
Version
1.0.4
License
MIT
Safe for commercial use
License identified from the packaged LICENSE file; the manifest declared none.
Automated license review — not legal advice.
