getconnections
A Connection, in the context of RBXScriptSignal, refers to a subscription between the signal (event) and the function to execute when it fires - not the social 'connections' of a user.
Your game may crash if C connections are not properly supported.
getconnections retrieves a list of Connection objects currently attached to a given RBXScriptSignal.
function getconnections(signal: RBXScriptSignal): {Connection}
Parameters
| Parameter |
Description |
signal |
The signal to inspect for active connections. |
Examples
Example 1
| Inspecting and invoking a Luau connection |
|---|
| local folder = Instance.new("Folder")
folder.ChildAdded:Connect(function()
print("Triggered")
end)
local connection = getconnections(folder.ChildAdded)[1] -- First connection in the list
connection.Function() -- Output: Triggered
connection:Fire() -- Same as above, Output: Triggered
print(typeof(connection.Thread)) -- Output: thread
|
Example 2
| Accessing a foreign/C connection |
|---|
| local cconnection = getconnections(game.Players.LocalPlayer.Idled)[1]
print(cconnection.Function) -- Output: nil
print(cconnection.Thread) -- Output: nil
|