Skip to main content

Connections

This is a class that makes handling connections (RBXConnections) easier!

Functions

NewConnection

Connections.NewConnection(
namestring,--

The name you want to assign to the connection

connectiontypeRBXScriptSignal,--

The type of connection you want to use

func(any) → (any),--

The function to run when the connection is fired

AutoConnectboolean?--

If true then the connection will automatically connect to the function

) → table--

Returns the table so that it's functions can be called

This is the function that creates the connection.

GetConnection

Connections.GetConnection(
Namestring--

The name of the connection you want to get

) → table | nil--

Returns the table so that it's functions can be called or nil, if it isn't found

This connection retrieves a connection that was previously created so it makes it possible to run the connections functions via other scripts

Clean

Connections.Clean() → ()

This function cleans up any connections that are in the "trash can", to add connections to the trash can you need to use the :AddToClean() function

Connect

Connections:Connect() → RBXScriptConnection--

Returns the newly connected connection

Connects the connection that was made.

Disconnect

Connections:Disconnect() → ()

Disconnects the connection if it was previously connected.

Destroy

Connections:Destroy() → ()

Cleans up/Destroys the connection that is no longer needed.

AddToClean

Connections:AddToClean() → ()

This connection adds said connection to a "trash can" so that when the .Clean() function is ran, all the connections in the "trash can" would be destroyed

ForceRun

Connections:ForceRun(
...any--

any arguments

) → any--

Returns the function data

This function allows you to force run the connection's given function with any arguments

ChangeFunction

Connections:ChangeFunction(
newfunc(any) → any--

the function you want it to update to

) → ()

This function updates the connection's previous function to the newly set one.

Show raw api
{
    "functions": [
        {
            "name": "NewConnection",
            "desc": "This is the function that creates the connection.",
            "params": [
                {
                    "name": "name",
                    "desc": "The name you want to assign to the connection",
                    "lua_type": "string"
                },
                {
                    "name": "connectiontype",
                    "desc": "The type of connection you want to use",
                    "lua_type": "RBXScriptSignal"
                },
                {
                    "name": "func",
                    "desc": "The function to run when the connection is fired",
                    "lua_type": "(any) -> (any)"
                },
                {
                    "name": "AutoConnect",
                    "desc": "If true then the connection will automatically connect to the function",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [
                {
                    "desc": "Returns the table so that it's functions can be called",
                    "lua_type": "table"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 20,
                "path": "src/Connections/init.luau"
            }
        },
        {
            "name": "Connect",
            "desc": "Connects the connection that was made.",
            "params": [],
            "returns": [
                {
                    "desc": "Returns the newly connected connection",
                    "lua_type": "RBXScriptConnection"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 44,
                "path": "src/Connections/init.luau"
            }
        },
        {
            "name": "Disconnect",
            "desc": "Disconnects the connection if it was previously connected.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 51,
                "path": "src/Connections/init.luau"
            }
        },
        {
            "name": "Destroy",
            "desc": "Cleans up/Destroys the connection that is no longer needed.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 59,
                "path": "src/Connections/init.luau"
            }
        },
        {
            "name": "GetConnection",
            "desc": "This connection retrieves a connection that was previously created so it makes it possible to run the connections functions via other scripts",
            "params": [
                {
                    "name": "Name",
                    "desc": "The name of the connection you want to get",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "Returns the table so that it's functions can be called or nil, if it isn't found",
                    "lua_type": "table | nil"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 70,
                "path": "src/Connections/init.luau"
            }
        },
        {
            "name": "AddToClean",
            "desc": "This connection adds said connection to a \"trash can\" so that when the .Clean() function is ran, all the connections in the \"trash can\" would be destroyed",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 81,
                "path": "src/Connections/init.luau"
            }
        },
        {
            "name": "ForceRun",
            "desc": "This function allows you to force run the connection's given function with any arguments",
            "params": [
                {
                    "name": "...",
                    "desc": "any arguments",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "Returns the function data",
                    "lua_type": "any"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 93,
                "path": "src/Connections/init.luau"
            }
        },
        {
            "name": "ChangeFunction",
            "desc": "This function updates the connection's previous function to the newly set one.",
            "params": [
                {
                    "name": "newfunc",
                    "desc": "the function you want it to update to",
                    "lua_type": "(any) -> any"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 101,
                "path": "src/Connections/init.luau"
            }
        },
        {
            "name": "Clean",
            "desc": "This function cleans up any connections that are in the \"trash can\", to add connections to the trash can you need to use the :AddToClean() function",
            "params": [],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 107,
                "path": "src/Connections/init.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Connections",
    "desc": "This is a class that makes handling connections ([RBXConnections](https://create.roblox.com/docs/reference/engine/datatypes/RBXScriptConnection)) easier!",
    "source": {
        "line": 9,
        "path": "src/Connections/init.luau"
    }
}