Skip to main content

SettingProperty

Functions

new

SettingProperty.new(
serviceBagServiceBag,
playerPlayer,
definitionSettingDefinition
) → SettingProperty<T>

Constructs a new SettingProperty.

Observe

SettingProperty:Observe() → Observable<T>

Observes the value of the setting property

SetValue

SettingProperty:SetValue(valueT) → ()

Sets the value of the setting property. Will warn if it cannot do so.

tip

Use [PromiseSetValue] to ensure value is set.

PromiseValue

SettingProperty:PromiseValue() → Promise<T>

Promises the value of the setting once it's loaded.

PromiseSetValue

SettingProperty:PromiseSetValue(valueT) → Promise

Promises to set the value

RestoreDefault

SettingProperty:RestoreDefault() → ()

Restores the setting to the default value

PromiseRestoreDefault

SettingProperty:PromiseRestoreDefault() → Promise

Restores the setting to the default value. This is different than setting to the default value because it means there is no "user-set" value which could lead to values changing if defaults change.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructs a new SettingProperty.",
            "params": [
                {
                    "name": "serviceBag",
                    "desc": "",
                    "lua_type": "ServiceBag"
                },
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                },
                {
                    "name": "definition",
                    "desc": "",
                    "lua_type": "SettingDefinition"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "SettingProperty<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 23,
                "path": "src/settings/src/Shared/Setting/SettingProperty.lua"
            }
        },
        {
            "name": "Observe",
            "desc": "Observes the value of the setting property",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<T>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 43,
                "path": "src/settings/src/Shared/Setting/SettingProperty.lua"
            }
        },
        {
            "name": "SetValue",
            "desc": "Sets the value of the setting property. Will warn if it cannot do so.\n\n:::tip\nUse [PromiseSetValue] to ensure value is set.\n:::",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 106,
                "path": "src/settings/src/Shared/Setting/SettingProperty.lua"
            }
        },
        {
            "name": "PromiseValue",
            "desc": "Promises the value of the setting once it's loaded.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<T>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 120,
                "path": "src/settings/src/Shared/Setting/SettingProperty.lua"
            }
        },
        {
            "name": "PromiseSetValue",
            "desc": "Promises to set the value",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 133,
                "path": "src/settings/src/Shared/Setting/SettingProperty.lua"
            }
        },
        {
            "name": "RestoreDefault",
            "desc": "Restores the setting to the default value",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 143,
                "path": "src/settings/src/Shared/Setting/SettingProperty.lua"
            }
        },
        {
            "name": "PromiseRestoreDefault",
            "desc": "Restores the setting to the default value. This is different than setting to the default value\nbecause it means there is no \"user-set\" value which could lead to values changing if\ndefaults change.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 159,
                "path": "src/settings/src/Shared/Setting/SettingProperty.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "SettingProperty",
    "desc": "",
    "source": {
        "line": 4,
        "path": "src/settings/src/Shared/Setting/SettingProperty.lua"
    }
}