Skip to main content

property_utils

std

this module provides utilities for safely working with properties.

Functions

has_property

property_utils.has_property(
instanceInstance,--

the instance to get the property from.

propertystring--

the property to get.

) → boolean--

whether or not the instance has the property.

check if an instance has a property, and adds it to the cache.

get_property

property_utils.get_property(
instanceInstance,--

the instance to get the property from.

propertystring--

the property to get.

) → (
any,
boolean
)--

the value of the property (or nil) and whether or not the operation was successful.

get a property from an instance.

set_property

property_utils.set_property(
instanceInstance,--

the instance to set the property on.

propertystring,--

the property to set.

valueany--

the value to set the property to.

) → boolean--

whether or not the operation was successful.

set a property on an instance.

Show raw api
{
    "functions": [
        {
            "name": "has_property",
            "desc": "check if an instance has a property, and adds it to the cache.",
            "params": [
                {
                    "name": "instance",
                    "desc": "the instance to get the property from.",
                    "lua_type": "Instance"
                },
                {
                    "name": "property",
                    "desc": "the property to get.",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "whether or not the instance has the property.",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 36,
                "path": "src/shared/kit/std/property.luau"
            }
        },
        {
            "name": "get_property",
            "desc": "get a property from an instance.",
            "params": [
                {
                    "name": "instance",
                    "desc": "the instance to get the property from.",
                    "lua_type": "Instance"
                },
                {
                    "name": "property",
                    "desc": "the property to get.",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "the value of the property (or nil) and whether or not the operation was successful.",
                    "lua_type": "(any, boolean)"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 79,
                "path": "src/shared/kit/std/property.luau"
            }
        },
        {
            "name": "set_property",
            "desc": "set a property on an instance.",
            "params": [
                {
                    "name": "instance",
                    "desc": "the instance to set the property on.",
                    "lua_type": "Instance"
                },
                {
                    "name": "property",
                    "desc": "the property to set.",
                    "lua_type": "string"
                },
                {
                    "name": "value",
                    "desc": "the value to set the property to.",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "whether or not the operation was successful.",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 101,
                "path": "src/shared/kit/std/property.luau"
            }
        }
    ],
    "properties": [
        {
            "name": "property_cache",
            "desc": "a cache of classnames and their properties.",
            "lua_type": "{ [string]: { includes: { string }, excludes: { string } } }",
            "private": true,
            "source": {
                "line": 20,
                "path": "src/shared/kit/std/property.luau"
            }
        }
    ],
    "types": [],
    "name": "property_utils",
    "desc": "this module provides utilities for *safely* working with properties.",
    "tags": [
        "std"
    ],
    "source": {
        "line": 10,
        "path": "src/shared/kit/std/property.luau"
    }
}