Skip to main content

Binder

Binds OOP classes to Roblox instances through CollectionService tags.

Functions

new

Binder.new(
tagstring,
classtable
) → Binder

Creates a new binder for the given CollectionService tag and OOP class.

Get

Binder.Get(
selfBinder,
instanceInstance
) → any?

Returns the bound object for the given instance, or nil if it is not bound.

GetAll

Binder.GetAll(selfBinder) → {[Instance]any}

Returns the dictionary of currently bound instances to objects.

Bind

Binder.Bind(
selfBinder,
instanceInstance
) → any?

Binds the class to the instance if it is not already bound.

Unbind

Binder.Unbind(
selfBinder,
instanceInstance
) → ()

Unbinds the class from the instance if it is currently bound.

TagInstance

Binder.TagInstance(
selfBinder,
instanceInstance
) → any?

Adds the binder tag to an instance and binds it.

UntagInstance

Binder.UntagInstance(
selfBinder,
instanceInstance
) → ()

Removes the binder tag from an instance and unbinds it.

Start

Binder.Start(selfBinder) → ()

Starts listening to CollectionService and binds all existing tagged instances.

Stop

Binder.Stop(selfBinder) → ()

Stops listening and unbinds all currently bound instances.

Destroy

Binder.Destroy(selfBinder) → ()

Destroys the binder and all bound objects.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Creates a new binder for the given CollectionService tag and OOP class.",
            "params": [
                {
                    "name": "tag",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "class",
                    "desc": "",
                    "lua_type": "table"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Binder"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 46,
                "path": "src/Packages/Binder/init.luau"
            }
        },
        {
            "name": "Get",
            "desc": "Returns the bound object for the given instance, or nil if it is not bound.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Binder"
                },
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 76,
                "path": "src/Packages/Binder/init.luau"
            }
        },
        {
            "name": "GetAll",
            "desc": "Returns the dictionary of currently bound instances to objects.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Binder"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{[Instance]: any}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 87,
                "path": "src/Packages/Binder/init.luau"
            }
        },
        {
            "name": "Bind",
            "desc": "Binds the class to the instance if it is not already bound.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Binder"
                },
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 99,
                "path": "src/Packages/Binder/init.luau"
            }
        },
        {
            "name": "Unbind",
            "desc": "Unbinds the class from the instance if it is currently bound.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Binder"
                },
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 124,
                "path": "src/Packages/Binder/init.luau"
            }
        },
        {
            "name": "TagInstance",
            "desc": "Adds the binder tag to an instance and binds it.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Binder"
                },
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 151,
                "path": "src/Packages/Binder/init.luau"
            }
        },
        {
            "name": "UntagInstance",
            "desc": "Removes the binder tag from an instance and unbinds it.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Binder"
                },
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 163,
                "path": "src/Packages/Binder/init.luau"
            }
        },
        {
            "name": "Start",
            "desc": "Starts listening to CollectionService and binds all existing tagged instances.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Binder"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 174,
                "path": "src/Packages/Binder/init.luau"
            }
        },
        {
            "name": "Stop",
            "desc": "Stops listening and unbinds all currently bound instances.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Binder"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 198,
                "path": "src/Packages/Binder/init.luau"
            }
        },
        {
            "name": "Destroy",
            "desc": "Destroys the binder and all bound objects.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Binder"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 220,
                "path": "src/Packages/Binder/init.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Binder",
    "desc": "Binds OOP classes to Roblox instances through CollectionService tags.",
    "source": {
        "line": 6,
        "path": "src/Packages/Binder/init.luau"
    }
}