Skip to content

Connection

A Connection object represents a successful binding between a handler function and a Signal.

INFO

A Connection can be obtained by making and connecting a handle to a signal.

Summary

Types

luau
type Connection = {
    Connected: boolean,
    Disconnect: (self: Connection) -> (),
}

Methods

MethodSignatureDescription
Disconnect() -> ()Disconnects the handler from the signal.

Properties

PropertyTypeDescription
ConnectedbooleanReturns true if the connection is still active.

Example

lua
local signal = require("@batteries/signal")
local onJump = signal.new() --> Signal

local connection = onJump:Connect(function() end) --> Connection

print(connection.Connected) -- true
connection:Disconnect()
print(connection.Connected) -- false