Skip to main content

attribute_utils

std

this module provides utilities for working with attributes in kit objects.

Types

string_data

interface string_data {
enums{string}?--

the different options the attribute can take. if not provided, the attribute can take any string value.

defaultstring--

the default value of the attribute.

__type"string"--

the type of the attribute. this will always be "string".

}

represents a string attribute.

number_data

interface number_data {
minnumber?--

the minimum value the attribute can take. if not provided, the attribute can take any number value.

maxnumber?--

the maximum value the attribute can take. if not provided, the attribute can take any number value.

defaultnumber--

the default value of the attribute.

__type"number"--

the type of the attribute. this will always be "number".

}

represents a number attribute.

boolean_data

interface boolean_data {
defaultboolean--

the default value of the attribute.

__type"boolean"--

the type of the attribute. this will always be "boolean".

}

represents a boolean attribute.

cframe_data

interface cframe_data {
defaultCFrame--

the default value of the attribute.

__type"cframe"--

the type of the attribute. this will always be "cframe".

}

represents a cframe attribute.

Functions

get

attribute_utils.get(
objectobject--

the object to get attributes for.

) → {[string]any}--

the attributes for the object.

get all attributes for an object.

attributes.string

attribute_utils.attributes.string(
data{
enums{string}?,
defaultstring
}--

the attribute data.

) → string_data--

the actual attribute data, used by the "get" function.

create a new string attribute.

attributes.number

attribute_utils.attributes.number(
data{
minnumber?,
maxnumber?,
defaultnumber
}--

the attribute data.

) → number_data--

the actual attribute data, used by the "get" function.

create a new number attribute.

attributes.boolean

attribute_utils.attributes.boolean(
data{defaultboolean}--

the attribute data.

) → boolean_data--

the actual attribute data, used by the "get" function.

create a new boolean attribute.

attributes.cframe

attribute_utils.attributes.cframe(
data{defaultCFrame}--

the attribute data.

) → cframe_data--

the actual attribute data, used by the "get" function.

create a new cframe attribute.

Show raw api
{
    "functions": [
        {
            "name": "get",
            "desc": "get all attributes for an object.",
            "params": [
                {
                    "name": "object",
                    "desc": "the object to get attributes for.",
                    "lua_type": "object"
                }
            ],
            "returns": [
                {
                    "desc": "the attributes for the object.",
                    "lua_type": "{ [string]: any }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 93,
                "path": "src/shared/kit/std/attributes.luau"
            }
        },
        {
            "name": "attributes.string",
            "desc": "create a new string attribute.",
            "params": [
                {
                    "name": "data",
                    "desc": "the attribute data.",
                    "lua_type": "{ enums: { string }?, default: string }"
                }
            ],
            "returns": [
                {
                    "desc": "the actual attribute data, used by the \"get\" function.",
                    "lua_type": "string_data"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 154,
                "path": "src/shared/kit/std/attributes.luau"
            }
        },
        {
            "name": "attributes.number",
            "desc": "create a new number attribute.",
            "params": [
                {
                    "name": "data",
                    "desc": "the attribute data.",
                    "lua_type": "{ min: number?, max: number?, default: number }"
                }
            ],
            "returns": [
                {
                    "desc": "the actual attribute data, used by the \"get\" function.",
                    "lua_type": "number_data"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 175,
                "path": "src/shared/kit/std/attributes.luau"
            }
        },
        {
            "name": "attributes.boolean",
            "desc": "create a new boolean attribute.",
            "params": [
                {
                    "name": "data",
                    "desc": "the attribute data.",
                    "lua_type": "{ default: boolean }"
                }
            ],
            "returns": [
                {
                    "desc": "the actual attribute data, used by the \"get\" function.",
                    "lua_type": "boolean_data"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 198,
                "path": "src/shared/kit/std/attributes.luau"
            }
        },
        {
            "name": "attributes.cframe",
            "desc": "create a new cframe attribute.",
            "params": [
                {
                    "name": "data",
                    "desc": "the attribute data.",
                    "lua_type": "{ default: CFrame }"
                }
            ],
            "returns": [
                {
                    "desc": "the actual attribute data, used by the \"get\" function.",
                    "lua_type": "cframe_data"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 217,
                "path": "src/shared/kit/std/attributes.luau"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "string_data",
            "desc": "represents a string attribute.",
            "fields": [
                {
                    "name": "enums",
                    "lua_type": "{ string }?",
                    "desc": "the different options the attribute can take. if not provided, the attribute can take any string value."
                },
                {
                    "name": "default",
                    "lua_type": "string",
                    "desc": "the default value of the attribute."
                },
                {
                    "name": "__type",
                    "lua_type": "\"string\"",
                    "desc": "the type of the attribute. this will always be \"string\"."
                }
            ],
            "source": {
                "line": 17,
                "path": "src/shared/kit/std/attributes.luau"
            }
        },
        {
            "name": "number_data",
            "desc": "represents a number attribute.",
            "fields": [
                {
                    "name": "min",
                    "lua_type": "number?",
                    "desc": "the minimum value the attribute can take. if not provided, the attribute can take any number value."
                },
                {
                    "name": "max",
                    "lua_type": "number?",
                    "desc": "the maximum value the attribute can take. if not provided, the attribute can take any number value."
                },
                {
                    "name": "default",
                    "lua_type": "number",
                    "desc": "the default value of the attribute."
                },
                {
                    "name": "__type",
                    "lua_type": "\"number\"",
                    "desc": "the type of the attribute. this will always be \"number\"."
                }
            ],
            "source": {
                "line": 36,
                "path": "src/shared/kit/std/attributes.luau"
            }
        },
        {
            "name": "boolean_data",
            "desc": "represents a boolean attribute.",
            "fields": [
                {
                    "name": "default",
                    "lua_type": "boolean",
                    "desc": "the default value of the attribute."
                },
                {
                    "name": "__type",
                    "lua_type": "\"boolean\"",
                    "desc": "the type of the attribute. this will always be \"boolean\"."
                }
            ],
            "source": {
                "line": 53,
                "path": "src/shared/kit/std/attributes.luau"
            }
        },
        {
            "name": "cframe_data",
            "desc": "represents a cframe attribute.",
            "fields": [
                {
                    "name": "default",
                    "lua_type": "CFrame",
                    "desc": "the default value of the attribute."
                },
                {
                    "name": "__type",
                    "lua_type": "\"cframe\"",
                    "desc": "the type of the attribute. this will always be \"cframe\"."
                }
            ],
            "source": {
                "line": 68,
                "path": "src/shared/kit/std/attributes.luau"
            }
        }
    ],
    "name": "attribute_utils",
    "desc": "this module provides utilities for *working with attributes* in *kit objects*.",
    "tags": [
        "std"
    ],
    "source": {
        "line": 80,
        "path": "src/shared/kit/std/attributes.luau"
    }
}