Skip to main content

BinderUtils

Utility methods for the binder object.

Functions

findFirstAncestor

BinderUtils.findFirstAncestor(
binderBinder<T>,
childInstance
) → T?

Finds the first ancestor that is bound with the current child. Skips the child class, of course.

findFirstChild

BinderUtils.findFirstChild(
binderBinder<T>,
parentInstance
) → T?

Finds the first child bound with the given binder and returns the bound class.

getChildren

BinderUtils.getChildren(
binderBinder<T>,
parentInstance
) → {T}

Gets all bound children of the given binder for the parent.

mapBinderListToTable

BinderUtils.mapBinderListToTable(bindersList{Binder<any>}) → {[string]Binder<any>}

Maps a list of binders into a look up table where the keys are tags and the value is the binder.

Duplicates are overwritten by the last entry.

getMappedFromList

BinderUtils.getMappedFromList(
tagsMap{[string]Binder<T>},
instanceList{Instance}
) → {T}

Given a mapping of tags to binders, retrieves the bound values from an instanceList by quering the list of :GetTags() instead of iterating over each binder.

This lookup should be faster when there are potentially many interaction points for a given tag map, but the actual bound list should be low.

getChildrenOfBinders

BinderUtils.getChildrenOfBinders(
bindersList{Binder<T>},
parentInstance
) → {T}

Given a list of binders retrieves all children bound with the given value.

getLinkedChildren

BinderUtils.getLinkedChildren(
binderBinder<T>,
linkNamestring,--

Name of the object values required

parentInstance
) → {T}

Gets all the linked (via objectValues of name linkName) bound objects

getDescendants

BinderUtils.getDescendants(
binderBinder<T>,
parentInstance
) → {T}

Gets all bound descendants of the given binder for the parent.

Show raw api
{
    "functions": [
        {
            "name": "findFirstAncestor",
            "desc": "Finds the first ancestor that is bound with the current child.\nSkips the child class, of course.",
            "params": [
                {
                    "name": "binder",
                    "desc": "",
                    "lua_type": "Binder<T>"
                },
                {
                    "name": "child",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "T?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 18,
                "path": "src/binder/src/Shared/BinderUtils.lua"
            }
        },
        {
            "name": "findFirstChild",
            "desc": "Finds the first child bound with the given binder and returns\nthe bound class.",
            "params": [
                {
                    "name": "binder",
                    "desc": "",
                    "lua_type": "Binder<T>"
                },
                {
                    "name": "parent",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "T?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 41,
                "path": "src/binder/src/Shared/BinderUtils.lua"
            }
        },
        {
            "name": "getChildren",
            "desc": "Gets all bound children of the given binder for the parent.",
            "params": [
                {
                    "name": "binder",
                    "desc": "",
                    "lua_type": "Binder<T>"
                },
                {
                    "name": "parent",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{T}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 62,
                "path": "src/binder/src/Shared/BinderUtils.lua"
            }
        },
        {
            "name": "mapBinderListToTable",
            "desc": "Maps a list of binders into a look up table where the keys are\ntags and the value is the binder.\n\nDuplicates are overwritten by the last entry.",
            "params": [
                {
                    "name": "bindersList",
                    "desc": "",
                    "lua_type": "{ Binder<any> }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [string]: Binder<any> }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 86,
                "path": "src/binder/src/Shared/BinderUtils.lua"
            }
        },
        {
            "name": "getMappedFromList",
            "desc": "Given a mapping of tags to binders, retrieves the bound values\nfrom an instanceList by quering the list of :GetTags() instead\nof iterating over each binder.\n\nThis lookup should be faster when there are potentially many\ninteraction points for a given tag map, but the actual bound\nlist should be low.",
            "params": [
                {
                    "name": "tagsMap",
                    "desc": "",
                    "lua_type": "{ [string]: Binder<T> }"
                },
                {
                    "name": "instanceList",
                    "desc": "",
                    "lua_type": "{ Instance }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ T }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 109,
                "path": "src/binder/src/Shared/BinderUtils.lua"
            }
        },
        {
            "name": "getChildrenOfBinders",
            "desc": "Given a list of binders retrieves all children bound with the given value.",
            "params": [
                {
                    "name": "bindersList",
                    "desc": "",
                    "lua_type": "{ Binder<T> }"
                },
                {
                    "name": "parent",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ T }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 134,
                "path": "src/binder/src/Shared/BinderUtils.lua"
            }
        },
        {
            "name": "getLinkedChildren",
            "desc": "Gets all the linked (via objectValues of name `linkName`) bound objects",
            "params": [
                {
                    "name": "binder",
                    "desc": "",
                    "lua_type": "Binder<T>"
                },
                {
                    "name": "linkName",
                    "desc": "Name of the object values required",
                    "lua_type": "string"
                },
                {
                    "name": "parent",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{T}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 150,
                "path": "src/binder/src/Shared/BinderUtils.lua"
            }
        },
        {
            "name": "getDescendants",
            "desc": "Gets all bound descendants of the given binder for the parent.",
            "params": [
                {
                    "name": "binder",
                    "desc": "",
                    "lua_type": "Binder<T>"
                },
                {
                    "name": "parent",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{T}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 176,
                "path": "src/binder/src/Shared/BinderUtils.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "BinderUtils",
    "desc": "Utility methods for the binder object.",
    "source": {
        "line": 5,
        "path": "src/binder/src/Shared/BinderUtils.lua"
    }
}