Skip to main content

Signal

Weaver's built-in implementation for signals.

This is meant to replace BindableEvents with simple and fast logic, omitting the need of Instances.

Types

ConnectionCallback

type ConnectionCallback = (...any) → ()

Functions

new

Signal.new() → Signal

Constructs a new Signal object.

Fire

Signal:Fire(......any) → ()

Fires the Signal with the specified data.

Connect

Signal:Connect(
CallbackConnectionCallback--

The function to connect.

) → SignalConnection

Connects Callback to this Signal, creating a new SignalConnection.

ConnectParallel

Signal:ConnectParallel(
CallbackConnectionCallback--

The function to connect.

) → SignalConnection

Connects Callback to this Signal in parallel, creating a new SignalConnection. Useful for Parallel Luau.

Once

Signal:Once(
CallbackConnectionCallback--

The function to connect.

) → SignalConnection

Connects Callback to this Signal, disconnecting it once the Signal has fired once.

Wait

This is a yielding function. When called, it will pause the Lua thread that called the function until a result is ready to be returned, without interrupting other scripts. Yields
Signal:Wait() → ...any--

All of the data that the Signal returned from one event.

Waits for the event to fire before resuming the current thread.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructs a new Signal object.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Signal"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 102,
                "path": "src/Util/Signal.luau"
            }
        },
        {
            "name": "Fire",
            "desc": "Fires the Signal with the specified data.",
            "params": [
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "...any"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 112,
                "path": "src/Util/Signal.luau"
            }
        },
        {
            "name": "Connect",
            "desc": "Connects `Callback` to this Signal, creating a new [SignalConnection].",
            "params": [
                {
                    "name": "Callback",
                    "desc": "The function to connect.",
                    "lua_type": "ConnectionCallback"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "SignalConnection"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 123,
                "path": "src/Util/Signal.luau"
            }
        },
        {
            "name": "ConnectParallel",
            "desc": "Connects `Callback` to this Signal in parallel, creating a new [SignalConnection]. Useful for Parallel Luau.",
            "params": [
                {
                    "name": "Callback",
                    "desc": "The function to connect.",
                    "lua_type": "ConnectionCallback"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "SignalConnection"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 132,
                "path": "src/Util/Signal.luau"
            }
        },
        {
            "name": "Once",
            "desc": "Connects `Callback` to this Signal, disconnecting it once the Signal has fired once.",
            "params": [
                {
                    "name": "Callback",
                    "desc": "The function to connect.",
                    "lua_type": "ConnectionCallback"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "SignalConnection"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 144,
                "path": "src/Util/Signal.luau"
            }
        },
        {
            "name": "Wait",
            "desc": "Waits for the event to fire before resuming the current thread.",
            "params": [],
            "returns": [
                {
                    "desc": "All of the data that the Signal returned from one event.",
                    "lua_type": "...any"
                }
            ],
            "function_type": "method",
            "yields": true,
            "source": {
                "line": 158,
                "path": "src/Util/Signal.luau"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "ConnectionCallback",
            "desc": "",
            "lua_type": "(...any) -> ()",
            "source": {
                "line": 80,
                "path": "src/Util/Signal.luau"
            }
        }
    ],
    "name": "Signal",
    "desc": "Weaver's built-in implementation for signals.\n\nThis is meant to replace [BindableEvents](https://create.roblox.com/docs/reference/engine/classes/BindableEvent) with simple and fast logic, omitting the need of Instances.",
    "source": {
        "line": 9,
        "path": "src/Util/Signal.luau"
    }
}