Skip to main content

TieDefinition

Constructs a new interface declaration which allows for interface usage between both Roblox API users and OOP users, as well as without accessing a ServiceBag.

Also allows for extensibility via implementing interfaces.

local require = require(script.Parent.loader).load(script)

local TieDefinition = require("TieDefinition")

return TieDefinition.new("GlobalLeaderboard", {
	-- Modification
	[TieDefinition.Realms.SERVER] = {
		RemoveAllEntries = TieDefinition.Types.METHOD;
		SetEntryValueForUserId = TieDefinition.Types.METHOD;
		IncrementEntryForUserId = TieDefinition.Types.METHOD;
		CreateEntry = TieDefinition.Types.METHOD;
	};

	-- List
	ObserveEntriesBrio = TieDefinition.Types.METHOD;
	GetEntryList = TieDefinition.Types.METHOD;

	-- Single
	ObserveEntryByUserId = TieDefinition.Types.METHOD;
	GetEntryForUserId = TieDefinition.Types.METHOD;

	-- Plural
	ObserveEntriesByUserIdBrio = TieDefinition.Types.METHOD;
	GetEntriesForUserId = TieDefinition.Types.METHOD;

	-- Rendering
	ObserveTopCount = TieDefinition.Types.METHOD;
	ObserveFormatType = TieDefinition.Types.METHOD;
	ObserveTitleTranslationKey = TieDefinition.Types.METHOD;
	ObserveEntryTranslationKey = TieDefinition.Types.METHOD;
})

Functions

new

TieDefinition.new(
definitionNamestring,
membersany
) → TieDefinition

Constructs a new TieDefinition with the given members

GetImplementations

TieDefinition:GetImplementations(
adorneeInstance,
tieRealmTieRealm?
) → {TieInterface}

Gets all valid interfaces for this adornee

ObserveChildrenBrio

TieDefinition:ObserveChildrenBrio(
adorneeInstance,
tieRealmTieRealm?
) → Observable<Brio<TieInterface>>

Observes all the children implementations for this adornee

Promise

TieDefinition:Promise(
adorneeAdornee,
tieRealmTieRealm?
) → Promise<TieInterface>

Promises the implementation

GetChildren

TieDefinition:GetChildren(
adorneeInstance,
tieRealmTieRealm?
) → {TieInterface}

Gets all valid interfaces for this adornee's children

Find

TieDefinition:Find(
adorneeAdornee,
tieRealmTieRealm?
) → TieInterface | nil

Finds the implementation on the adornee. Alais for [FindFirstImplementation]

ObserveAllTaggedBrio

TieDefinition:ObserveAllTaggedBrio(
tagNamestring,
tieRealmTieRealm?
) → TieInterface | nil

Observes all implementations that are tagged with the given tag name

FindFirstImplementation

TieDefinition:FindFirstImplementation(
adorneeInstance,
tieRealmTieRealm?
) → TieInterface

Finds the first valid interfaces for this adornee

HasImplementation

TieDefinition:HasImplementation(
adorneeInstance,
tieRealmTieRealm?
) → boolean

Returns true if the adornee implements the interface, and false otherwise.

ObserveIsImplemented

TieDefinition:ObserveIsImplemented(
adorneeInstance,
tieRealmTieRealm?
) → Observable<boolean>>

Observes whether the adornee implements the interface.

ObserveIsImplementation

TieDefinition:ObserveIsImplementation(
implParentInstance,
tieRealmTieRealm?
) → Observable<boolean>>

Observes whether the implParent is a valid implementation

ObserveIsImplementedOn

TieDefinition:ObserveIsImplementedOn(
implParentInstance,
adorneeInstance,
tieRealmTieRealm?
) → Observable<boolean>>

Observes whether the implParent is a valid implementation on the given adornee

ObserveBrio

TieDefinition:ObserveBrio(
adorneeInstance,
tieRealmTieRealm?
) → Observable<Brio<TieImplementation<T>>>

Observes a valid implementation wrapped in a brio if it exists.

Observe

TieDefinition:Observe(
adorneeInstance,
tieRealmTieRealm?
) → Observable<TieImplementation<T> | nil>>

Observes a valid implementation if it exists, or nil

ObserveImplementationsBrio

TieDefinition:ObserveImplementationsBrio(
adorneeInstance,
tieRealmTieRealm?
) → Observable<Brio<TieImplementation<T>>>

Observes valid implementations wrapped in a brio if it exists.

Implement

TieDefinition:Implement(
adorneeInstance,--

Adornee to implement interface on

implementertable?,--

Table with all interface values or nil

tieRealmTieRealm?
) → TieImplementation<T>

Ensures implementation of the object, binding table values and Lua OOP objects to Roblox objects that can be invoked generally.

Get

TieDefinition:Get(
adorneeInstance,--

Adornee to get interface on

tieRealmTieRealm?
) → TieInterface<T>

Gets an interface to the tie definition. Not this can be done on any Roblox instance. If the instance does not implement the interface, invoking interface methods, or querying the interface will result in errors.

tip

Probably use :Find() instead of Get, since this always returns an interface.

GetName

TieDefinition:GetName() → string

Gets the name of the definition

GetValidContainerNameSet

TieDefinition:GetValidContainerNameSet(tieRealmTieRealm) → {[string]boolean}

Gets the valid container name set for the tie definition

GetNewContainerName

TieDefinition:GetNewContainerName(tieRealmTieRealm) → string

Gets a container name for a new container. See [GetValidContainerNameSet] for the full set of valid container names for the tie definition.

IsImplementation

TieDefinition:IsImplementation(
implParentInstance,
tieRealmTieRealm?--

Optional tie realm

) → boolean

Returns true if the implParent is an implementation

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructs a new TieDefinition with the given members",
            "params": [
                {
                    "name": "definitionName",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "members",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "TieDefinition"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 88,
                "path": "src/tie/src/Shared/TieDefinition.lua"
            }
        },
        {
            "name": "GetImplementations",
            "desc": "Gets all valid interfaces for this adornee",
            "params": [
                {
                    "name": "adornee",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "tieRealm",
                    "desc": "",
                    "lua_type": "TieRealm?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ TieInterface }"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 145,
                "path": "src/tie/src/Shared/TieDefinition.lua"
            }
        },
        {
            "name": "ObserveChildrenBrio",
            "desc": "Observes all the children implementations for this adornee",
            "params": [
                {
                    "name": "adornee",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "tieRealm",
                    "desc": "",
                    "lua_type": "TieRealm?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<TieInterface>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 225,
                "path": "src/tie/src/Shared/TieDefinition.lua"
            }
        },
        {
            "name": "Promise",
            "desc": "Promises the implementation",
            "params": [
                {
                    "name": "adornee",
                    "desc": "",
                    "lua_type": "Adornee"
                },
                {
                    "name": "tieRealm",
                    "desc": "",
                    "lua_type": "TieRealm?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<TieInterface>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 243,
                "path": "src/tie/src/Shared/TieDefinition.lua"
            }
        },
        {
            "name": "GetChildren",
            "desc": "Gets all valid interfaces for this adornee's children",
            "params": [
                {
                    "name": "adornee",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "tieRealm",
                    "desc": "",
                    "lua_type": "TieRealm?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ TieInterface }"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 263,
                "path": "src/tie/src/Shared/TieDefinition.lua"
            }
        },
        {
            "name": "Find",
            "desc": "Finds the implementation on the adornee. Alais for [FindFirstImplementation]",
            "params": [
                {
                    "name": "adornee",
                    "desc": "",
                    "lua_type": "Adornee"
                },
                {
                    "name": "tieRealm",
                    "desc": "",
                    "lua_type": "TieRealm?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "TieInterface | nil"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 286,
                "path": "src/tie/src/Shared/TieDefinition.lua"
            }
        },
        {
            "name": "ObserveAllTaggedBrio",
            "desc": "Observes all implementations that are tagged with the given tag name",
            "params": [
                {
                    "name": "tagName",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "tieRealm",
                    "desc": "",
                    "lua_type": "TieRealm?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "TieInterface | nil"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 300,
                "path": "src/tie/src/Shared/TieDefinition.lua"
            }
        },
        {
            "name": "FindFirstImplementation",
            "desc": "Finds the first valid interfaces for this adornee",
            "params": [
                {
                    "name": "adornee",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "tieRealm",
                    "desc": "",
                    "lua_type": "TieRealm?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "TieInterface"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 317,
                "path": "src/tie/src/Shared/TieDefinition.lua"
            }
        },
        {
            "name": "HasImplementation",
            "desc": "Returns true if the adornee implements the interface, and false otherwise.",
            "params": [
                {
                    "name": "adornee",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "tieRealm",
                    "desc": "",
                    "lua_type": "TieRealm?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 341,
                "path": "src/tie/src/Shared/TieDefinition.lua"
            }
        },
        {
            "name": "ObserveIsImplemented",
            "desc": "Observes whether the adornee implements the interface.",
            "params": [
                {
                    "name": "adornee",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "tieRealm",
                    "desc": "",
                    "lua_type": "TieRealm?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<boolean>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 368,
                "path": "src/tie/src/Shared/TieDefinition.lua"
            }
        },
        {
            "name": "ObserveIsImplementation",
            "desc": "Observes whether the implParent is a valid implementation",
            "params": [
                {
                    "name": "implParent",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "tieRealm",
                    "desc": "",
                    "lua_type": "TieRealm?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<boolean>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 389,
                "path": "src/tie/src/Shared/TieDefinition.lua"
            }
        },
        {
            "name": "ObserveIsImplementedOn",
            "desc": "Observes whether the implParent is a valid implementation on the given adornee",
            "params": [
                {
                    "name": "implParent",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "adornee",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "tieRealm",
                    "desc": "",
                    "lua_type": "TieRealm?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<boolean>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 413,
                "path": "src/tie/src/Shared/TieDefinition.lua"
            }
        },
        {
            "name": "ObserveBrio",
            "desc": "Observes a valid implementation wrapped in a brio if it exists.",
            "params": [
                {
                    "name": "adornee",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "tieRealm",
                    "desc": "",
                    "lua_type": "TieRealm?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<TieImplementation<T>>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 442,
                "path": "src/tie/src/Shared/TieDefinition.lua"
            }
        },
        {
            "name": "Observe",
            "desc": "Observes a valid implementation if it exists, or nil",
            "params": [
                {
                    "name": "adornee",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "tieRealm",
                    "desc": "",
                    "lua_type": "TieRealm?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<TieImplementation<T> | nil>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 464,
                "path": "src/tie/src/Shared/TieDefinition.lua"
            }
        },
        {
            "name": "ObserveImplementationsBrio",
            "desc": "Observes valid implementations wrapped in a brio if it exists.",
            "params": [
                {
                    "name": "adornee",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "tieRealm",
                    "desc": "",
                    "lua_type": "TieRealm?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<TieImplementation<T>>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 482,
                "path": "src/tie/src/Shared/TieDefinition.lua"
            }
        },
        {
            "name": "Implement",
            "desc": "Ensures implementation of the object, binding table values and Lua OOP objects\nto Roblox objects that can be invoked generally.\n\n```lua\n\n```",
            "params": [
                {
                    "name": "adornee",
                    "desc": "Adornee to implement interface on",
                    "lua_type": "Instance"
                },
                {
                    "name": "implementer",
                    "desc": "Table with all interface values or nil",
                    "lua_type": "table?"
                },
                {
                    "name": "tieRealm",
                    "desc": "",
                    "lua_type": "TieRealm?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "TieImplementation<T>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 586,
                "path": "src/tie/src/Shared/TieDefinition.lua"
            }
        },
        {
            "name": "Get",
            "desc": "Gets an interface to the tie definition. Not this can be done\non any Roblox instance. If the instance does not implement the interface,\ninvoking interface methods, or querying the interface will result\nin errors.\n\n:::tip\nProbably use :Find() instead of Get, since this always returns an interface.\n:::",
            "params": [
                {
                    "name": "adornee",
                    "desc": "Adornee to get interface on",
                    "lua_type": "Instance"
                },
                {
                    "name": "tieRealm",
                    "desc": "",
                    "lua_type": "TieRealm?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "TieInterface<T>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 610,
                "path": "src/tie/src/Shared/TieDefinition.lua"
            }
        },
        {
            "name": "GetName",
            "desc": "Gets the name of the definition",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 623,
                "path": "src/tie/src/Shared/TieDefinition.lua"
            }
        },
        {
            "name": "GetValidContainerNameSet",
            "desc": "Gets the valid container name set for the tie definition",
            "params": [
                {
                    "name": "tieRealm",
                    "desc": "",
                    "lua_type": "TieRealm"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [string]: boolean }"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 633,
                "path": "src/tie/src/Shared/TieDefinition.lua"
            }
        },
        {
            "name": "GetNewContainerName",
            "desc": "Gets a container name for a new container. See [GetValidContainerNameSet]\nfor the full set of valid container names for the tie definition.",
            "params": [
                {
                    "name": "tieRealm",
                    "desc": "",
                    "lua_type": "TieRealm"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 673,
                "path": "src/tie/src/Shared/TieDefinition.lua"
            }
        },
        {
            "name": "IsImplementation",
            "desc": "Returns true if the implParent is an implementation",
            "params": [
                {
                    "name": "implParent",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "tieRealm",
                    "desc": "Optional tie realm",
                    "lua_type": "TieRealm?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 701,
                "path": "src/tie/src/Shared/TieDefinition.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "TieDefinition",
    "desc": "Constructs a new interface declaration which allows for interface usage\nbetween both Roblox API users and OOP users, as well as without accessing a\n[ServiceBag].\n\nAlso allows for extensibility via implementing interfaces.\n\n```lua\nlocal require = require(script.Parent.loader).load(script)\n\nlocal TieDefinition = require(\"TieDefinition\")\n\nreturn TieDefinition.new(\"GlobalLeaderboard\", {\n\t-- Modification\n\t[TieDefinition.Realms.SERVER] = {\n\t\tRemoveAllEntries = TieDefinition.Types.METHOD;\n\t\tSetEntryValueForUserId = TieDefinition.Types.METHOD;\n\t\tIncrementEntryForUserId = TieDefinition.Types.METHOD;\n\t\tCreateEntry = TieDefinition.Types.METHOD;\n\t};\n\n\t-- List\n\tObserveEntriesBrio = TieDefinition.Types.METHOD;\n\tGetEntryList = TieDefinition.Types.METHOD;\n\n\t-- Single\n\tObserveEntryByUserId = TieDefinition.Types.METHOD;\n\tGetEntryForUserId = TieDefinition.Types.METHOD;\n\n\t-- Plural\n\tObserveEntriesByUserIdBrio = TieDefinition.Types.METHOD;\n\tGetEntriesForUserId = TieDefinition.Types.METHOD;\n\n\t-- Rendering\n\tObserveTopCount = TieDefinition.Types.METHOD;\n\tObserveFormatType = TieDefinition.Types.METHOD;\n\tObserveTitleTranslationKey = TieDefinition.Types.METHOD;\n\tObserveEntryTranslationKey = TieDefinition.Types.METHOD;\n})\n```",
    "source": {
        "line": 44,
        "path": "src/tie/src/Shared/TieDefinition.lua"
    }
}