Option¶
Option helpers for Lilia user settings, including registration, lookup, localization, persistence, and configuration menu display.
Overview
lia.option.add(key, name, desc, default, callback, data)View Source
Purpose
Registers an option and stores its display metadata, default value, callback, type information, and configuration data.
Realm
Shared
Parameters
string key The unique option identifier.
string name The display name or language token for the option.
string desc The display description or language token for the option.
any default The default value used when no saved value exists.
function callback optional Optional function called with the old and new values when the option changes.
table data Option metadata such as category, type, min, max, decimals, options, visible, shouldNetwork, and isQuick.
Example Usage
lia.option.add("exampleOption", "@exampleOption", "@exampleOptionDesc", true, nil, {
category = "@core",
type = "Boolean"
})
lia.option.getDisplayName(key)View Source
Purpose
Returns the localized display name for a registered option.
Realm
Shared
Parameters
string key The unique option identifier.
Returns
string The localized option display name, or the key when the option is not registered.
Example Usage
local name = lia.option.getDisplayName("descriptionWidth")
lia.option.getDisplayDesc(key)View Source
Purpose
Returns the localized display description for a registered option.
Realm
Shared
Parameters
string key The unique option identifier.
Returns
string The localized option description, or an empty string when the option is not registered.
Example Usage
local desc = lia.option.getDisplayDesc("descriptionWidth")
lia.option.getDisplayCategory(key)View Source
Purpose
Returns the localized display category for a registered option.
Realm
Shared
Parameters
string key The unique option identifier.
Returns
string The localized option category, or the localized misc category when none is set.
Example Usage
local category = lia.option.getDisplayCategory("descriptionWidth")
lia.option.getOptions(key)View Source
Purpose
Returns normalized and localized selectable values for a registered table option.
Realm
Shared
Parameters
string key The unique option identifier.
Returns
table A table of selectable option entries containing label, rawLabel, and value fields.
Example Usage
local options = lia.option.getOptions("weaponSelectorPosition")
lia.option.set(key, value)View Source
lia.option.get(key, default)View Source
Purpose
Returns the current value for a registered option.
Realm
Shared
Parameters
string key The unique option identifier.
any default Fallback value returned when the option is not registered and has no stored default.
Returns
any The current option value, the registered default value, or the provided fallback default.
Example Usage
local enabled = lia.option.get("drawItemHoverInfo", true)
lia.option.save()View Source
lia.option.load()View Source
Hooks
Library-specific hooks documented for this library.
InitializedOptions()View Source
OptionAdded(key, option)View Source
OptionChanged(key, oldValue, newValue)View Source
OptionReceived(client, key, value)View Source
ThirdPersonToggled(enabled)View Source
Purpose
Runs when the `thirdPersonEnabled` option changes.
Realm
Client
Parameters
boolean enabled True when third-person view was enabled, false when it was disabled.