Skip to main content

misc_utils

utility

this module contains miscellaneous utils that all scripts can access and use.

Types

uuid_type

type uuid_type = "object"

a type of uuid. represents a category of uuids.

Functions

traverse

misc_utils.traverse(
rootInstance,--

the roblox instance to loop through.

parse_fn(childInstance) → (),--

the function to call for each child.

classstring?--

the class to filter by.

) → ()

loop through all descendants of the given instance and call the parse function for each child.

you can also provide an optional class name to filter by.

get_table_size

misc_utils.get_table_size(
tbl{any} | {[string]any}--

the table to get the size of.

) → number--

the size of the table.

get the size of an array or a dictionary.

collect

misc_utils.collect(
eventRBXScriptSignal--

the signal to collect events from.

) → (
() → (
number,
any
),
() → ()
)--

the iterator function and the disconnect function.

collect events from a signal.

throttle

misc_utils.throttle(
time_or_namenumber | any,--

the identifier for the throttle system.

timenumber?--

the time to wait before allowing the event to fire again.

) → boolean--

whether or not the event can continue.

throttle a certain event. this works identically to matter's useThrottle hook.

create_uuid

misc_utils.create_uuid(
uuid_typeuuid_type--

the type of uuid to create.

) → string--

the created uuid.

create a random uuid in a category.

the uuid is 14 characters long, and consists of both uppercase and lowercase letters, and numbers from 0-9.

copy

deprecated in 0.1.0
</>
This was deprecated in 0.1.0
use `misc_utils.traverse` instead
misc_utils.copy(
rootInstance,--

the roblox instance to loop through.

destinationFolder--

the folder to copy the children to.

) → ()

copy all children of the given instance to the destination folder. children have to be ModuleScripts in order to be copied.

Show raw api
{
    "functions": [
        {
            "name": "traverse",
            "desc": "loop through all descendants of the given instance and call the parse function for each child.\n\nyou can also provide an optional class name to filter by.",
            "params": [
                {
                    "name": "root",
                    "desc": "the roblox instance to loop through.",
                    "lua_type": "Instance"
                },
                {
                    "name": "parse_fn",
                    "desc": "the function to call for each child.",
                    "lua_type": "(child: Instance) -> ()"
                },
                {
                    "name": "class",
                    "desc": "the class to filter by.",
                    "lua_type": "string?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 35,
                "path": "src/shared/utils/misc.luau"
            }
        },
        {
            "name": "copy",
            "desc": "copy all children of the given instance to the destination folder.\nchildren have to be ModuleScripts in order to be copied.",
            "params": [
                {
                    "name": "root",
                    "desc": "the roblox instance to loop through.",
                    "lua_type": "Instance"
                },
                {
                    "name": "destination",
                    "desc": "the folder to copy the children to.",
                    "lua_type": "Folder"
                }
            ],
            "returns": [],
            "function_type": "static",
            "deprecated": {
                "version": "0.1.0",
                "desc": "use `misc_utils.traverse` instead"
            },
            "source": {
                "line": 62,
                "path": "src/shared/utils/misc.luau"
            }
        },
        {
            "name": "get_table_size",
            "desc": "get the size of an array or a dictionary.",
            "params": [
                {
                    "name": "tbl",
                    "desc": "the table to get the size of.",
                    "lua_type": "{ any } | { [string]: any }"
                }
            ],
            "returns": [
                {
                    "desc": "the size of the table.",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 81,
                "path": "src/shared/utils/misc.luau"
            }
        },
        {
            "name": "collect",
            "desc": "collect events from a signal.",
            "params": [
                {
                    "name": "event",
                    "desc": "the signal to collect events from.",
                    "lua_type": "RBXScriptSignal"
                }
            ],
            "returns": [
                {
                    "desc": "the iterator function and the disconnect function.",
                    "lua_type": "(() -> (number, any), () -> ())"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 100,
                "path": "src/shared/utils/misc.luau"
            }
        },
        {
            "name": "throttle",
            "desc": "throttle a certain event. this works identically to matter's useThrottle hook.",
            "params": [
                {
                    "name": "time_or_name",
                    "desc": "the identifier for the throttle system.",
                    "lua_type": "number | any"
                },
                {
                    "name": "time",
                    "desc": "the time to wait before allowing the event to fire again.",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "whether or not the event can continue.",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 144,
                "path": "src/shared/utils/misc.luau"
            }
        },
        {
            "name": "create_uuid",
            "desc": "create a random uuid in a category.\n\nthe uuid is 14 characters long, and consists of both uppercase and lowercase letters, and numbers from 0-9.",
            "params": [
                {
                    "name": "uuid_type",
                    "desc": "the type of uuid to create.",
                    "lua_type": "uuid_type"
                }
            ],
            "returns": [
                {
                    "desc": "the created uuid.",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 198,
                "path": "src/shared/utils/misc.luau"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "uuid_type",
            "desc": "a type of uuid. represents a category of uuids.",
            "lua_type": "\"object\"",
            "source": {
                "line": 18,
                "path": "src/shared/utils/misc.luau"
            }
        }
    ],
    "name": "misc_utils",
    "desc": "this module contains *miscellaneous utils* that *all* scripts can access and use.",
    "tags": [
        "utility"
    ],
    "source": {
        "line": 10,
        "path": "src/shared/utils/misc.luau"
    }
}