Skip to main content

Property

This item only works when running on the client. Client

A table of utility functions for working with Instance Properties that can be used to speed up the process of writing repository scripts for client objects.

Functions

getPropertySafe

shorthand
Property.getPropertySafe(
instanceany,
propertystring
) → (
any,
boolean
)

Safely gets a property of an object. Will return nil if the property does not exist, or if any errors occur.

setPropertySafe

shorthand
Property.setPropertySafe(
instanceany,
propertystring,
valueany
) → boolean

Safely sets a property of an object.

assureValueType

shorthand
Property.assureValueType(
valueunknown,
defaultdefaultType
) → defaultType

Checks if value and default are of the same type. If not, it will return the default value.

assureAttribute

shorthand
Property.assureAttribute(
instanceInstance?,
configNamestring,
defaultdefaultType
) → defaultType

Shorthand for utility.assureValueType(instance:GetAttribute(configName), default)

Show raw api
{
    "functions": [
        {
            "name": "getPropertySafe",
            "desc": "    \nSafely gets a property of an object. \nWill return `nil` if the property does not exist, or if any errors occur.",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "any"
                },
                {
                    "name": "property",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any"
                },
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "tags": [
                "shorthand"
            ],
            "source": {
                "line": 19,
                "path": "mirror/Kit.Utility.Property.luau"
            }
        },
        {
            "name": "setPropertySafe",
            "desc": "Safely sets a property of an object.",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "any"
                },
                {
                    "name": "property",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "tags": [
                "shorthand"
            ],
            "source": {
                "line": 33,
                "path": "mirror/Kit.Utility.Property.luau"
            }
        },
        {
            "name": "assureValueType",
            "desc": "    \nChecks if `value` and `default` are of the same type. \nIf not, it will return the `default` value.",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "unknown"
                },
                {
                    "name": "default",
                    "desc": "",
                    "lua_type": "defaultType"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "defaultType\n"
                }
            ],
            "function_type": "static",
            "tags": [
                "shorthand"
            ],
            "source": {
                "line": 46,
                "path": "mirror/Kit.Utility.Property.luau"
            }
        },
        {
            "name": "assureAttribute",
            "desc": "    \nShorthand for `utility.assureValueType(instance:GetAttribute(configName), default)`",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance?"
                },
                {
                    "name": "configName",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "default",
                    "desc": "",
                    "lua_type": "defaultType"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "defaultType"
                }
            ],
            "function_type": "static",
            "tags": [
                "shorthand"
            ],
            "source": {
                "line": 58,
                "path": "mirror/Kit.Utility.Property.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Property",
    "desc": "A table of utility functions for working with Instance Properties that can be used to speed up the process of writing repository scripts for client objects.",
    "realm": [
        "Client"
    ],
    "source": {
        "line": 10,
        "path": "mirror/Kit.Utility.Property.luau"
    }
}