Skip to main content

BindableEventWrapper

A wrapper around a BindableEvent that exposes a similar API to that of a normal signal library.

Please note that this has the same limitations as a regular BindableEvent.

local roundEnded = BindableEventWrapper.new()

roundEnded:Connect(function(winner)
    print(winner .. " won the round!")
end)

roundedEnded:Fire("Jerry")

Functions

new

BindableEventWrapper.new(
eventBindableEvent?--

If this is not nil, the wrapper will wrap the provided BindableEvent instead of creating a new one.

) → ()

Instantiates a new BindableEventWrapper.

Fire

BindableEventWrapper.Fire(
...any
) → ()

Fires the internal BindableEvent.

See BindableEvent:Fire

Connect

BindableEventWrapper.Connect(
callback(...any) → ()
) → RBXScriptConnection

Connects to the internal BindableEvent's Event and returns the RBXScriptConnection representing it.

See RBXScriptSignal:Connect

ConnectParallel

BindableEventWrapper.ConnectParallel(
callback(...any) → ()
) → RBXScriptConnection

Once

BindableEventWrapper.Once(
callback(...any) → ()
) → RBXScriptConnection

Connects to the internal BindableEvent's event such that the connection is disconnected after the first event is delivered. Returns the RBXScriptConnection representing the connection.

See RBXScriptSignal: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
BindableEventWrapper.Wait(selfBindableEventWrapper) → ...any

Yields until the internal BindableEvent's event fires. Returns the arguments provided by the signal.

See RBXScriptSignal:Wait

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Instantiates a new BindableEventWrapper.",
            "params": [
                {
                    "name": "event",
                    "desc": "If this is not nil, the wrapper will wrap the provided [BindableEvent] instead of creating a new one.",
                    "lua_type": "BindableEvent?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 40,
                "path": "src/init.luau"
            }
        },
        {
            "name": "Fire",
            "desc": "Fires the internal [BindableEvent].\n\nSee [BindableEvent:Fire]",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "BindableEventWrapper"
                },
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 67,
                "path": "src/init.luau"
            }
        },
        {
            "name": "Connect",
            "desc": "Connects to the internal BindableEvent's Event and returns the [RBXScriptConnection] representing it.\n\nSee [RBXScriptSignal:Connect]",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "BindableEventWrapper"
                },
                {
                    "name": "callback",
                    "desc": "",
                    "lua_type": "(...any) -> ()\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RBXScriptConnection\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 78,
                "path": "src/init.luau"
            }
        },
        {
            "name": "ConnectParallel",
            "desc": "See [RBXScriptSignal:ConnectParallel]",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "BindableEventWrapper"
                },
                {
                    "name": "callback",
                    "desc": "",
                    "lua_type": "(...any) -> ()\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RBXScriptConnection\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 90,
                "path": "src/init.luau"
            }
        },
        {
            "name": "Once",
            "desc": "Connects to the internal BindableEvent's event such that the connection is disconnected after the first event is delivered. Returns the [RBXScriptConnection] representing the connection.\n\nSee [RBXScriptSignal:Once]",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "BindableEventWrapper"
                },
                {
                    "name": "callback",
                    "desc": "",
                    "lua_type": "(...any) -> ()\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RBXScriptConnection\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 104,
                "path": "src/init.luau"
            }
        },
        {
            "name": "Wait",
            "desc": "Yields until the internal BindableEvent's event fires. Returns the arguments provided by the signal.\n\nSee [RBXScriptSignal:Wait]",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "BindableEventWrapper"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "...any\n"
                }
            ],
            "function_type": "static",
            "yields": true,
            "source": {
                "line": 119,
                "path": "src/init.luau"
            }
        }
    ],
    "properties": [
        {
            "name": "_inner",
            "desc": "The underlying bindable event used by the class",
            "lua_type": "BindableEvent",
            "private": true,
            "source": {
                "line": 33,
                "path": "src/init.luau"
            }
        }
    ],
    "types": [],
    "name": "BindableEventWrapper",
    "desc": "A wrapper around a [BindableEvent] that exposes a similar API to that of a normal signal library.\n\nPlease note that this has the same [limitations](https://create.roblox.com/docs/scripting/events/bindable#argument-limitations) as a regular BindableEvent.\n\n```lua\nlocal roundEnded = BindableEventWrapper.new()\n\nroundEnded:Connect(function(winner)\n    print(winner .. \" won the round!\")\nend)\n\nroundedEnded:Fire(\"Jerry\")\n```",
    "source": {
        "line": 18,
        "path": "src/init.luau"
    }
}