Skip to content
This repository was archived by the owner on Sep 13, 2025. It is now read-only.

Commit 61508e0

Browse files
author
Command17
committed
Commit for v1.0.1
1 parent 1b0b8fa commit 61508e0

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# <kbd>RbxSignal</kbd>
22

3-
Basic Signal class for roblox!
3+
Basic Signal class for roblox!
4+
5+
Install with Wally go to the resent release

src/init.lua

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ connection.__index = connection
1111

1212
export type callback = (...any) -> ...any
1313

14-
function connection.new(callback, signal)
14+
function connection.new(callback)
1515
return setmetatable({
1616
Connected = true,
1717
_callback = callback,
18-
_signal = signal
1918
}, connection)
2019
end
2120

@@ -53,7 +52,7 @@ end
5352
function signal:Connect(callback: callback) -- Connects a function to the Signal
5453
assert(typeof(callback) == "function", string.format("Invalid argument #1 (function expected got %s)", typeof(callback)))
5554

56-
local _connection = connection.new(callback, self)
55+
local _connection = connection.new(callback)
5756

5857
table.insert(self._listeners, _connection)
5958

@@ -70,7 +69,7 @@ function signal:ConnectParallel(callback: callback) -- Connects a function to th
7069
task.synchronize()
7170
end
7271

73-
function signal:Once(callback: callback)
72+
function signal:Once(callback: callback) -- Disconnects after one fire
7473
local _connection = nil
7574

7675
_connection = self:Connect(function(...)
@@ -82,7 +81,7 @@ function signal:Once(callback: callback)
8281
return _connection
8382
end
8483

85-
function signal:Wait()
84+
function signal:Wait() -- Waits until the signal is fired
8685
local waitCoroutine = coroutine.running()
8786

8887
self:Once(function(...)
@@ -110,15 +109,17 @@ function signal:FireParallel(...: any) -- Call the callbacks from every listener
110109
task.synchronize()
111110
end
112111

113-
function signal:DisconnectAll()
112+
function signal:DisconnectAll() -- Disconnects all Listeners
114113
for i, v in ipairs(self._listeners) do
115114
v:Disconnect()
116115
end
117116

118117
table.clear(self._listeners)
119118
end
120119

121-
signal.Destroy = signal.DisconnectAll
120+
signal.Destroy = signal.DisconnectAll -- Signal:Destroy() -> Signal:DisconnectAll()
121+
122+
-- Make the signal class strict
122123

123124
setmetatable(signal, {
124125
__index = function(_, key)

src/wally.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
2-
name = "comma/rbxsignal"
3-
version = "1.0.0"
2+
name = "command17/rbxsignal"
3+
version = "1.0.1"
44
description = "Basic Signal class"
55
license = "MIT"
66
registry = "https://github.com/UpliftGames/wally-index"

0 commit comments

Comments
 (0)