Option
User-configurable settings management system for the Lilia framework.
Overview
lia.option.add(key, name, desc, default, callback, data)
Purpose
Register a configurable option with defaults, callbacks, and metadata.
When Called
During initialization to expose settings to the config UI/system.
Parameters
string key Option identifier to resolve choices for.
string name Display name or localization key.
string desc Description or localization key.
any default Default value; determines inferred type.
function callback optional function(old, new) invoked on change.
table data Extra fields: category, min/max, options, visible, shouldNetwork, isQuick, type, etc.
Example Usage
lia.option.add("hudScale", "HUD Scale", "Scale HUD elements", 1.0, function(old, new)
hook.Run("HUDScaleChanged", old, new)
end, {
category = "@Core",
min = 0.5,
max = 1.5,
decimals = 2,
isQuick = true
})
lia.option.getDisplayName(key)
Purpose
Retrieve the localized display name of an option entry.
When Called
When rendering option entries in the config UI or sorting them by name.
Parameters
string key The option key to look up.
Returns
string Localized display name, or the raw key if the entry does not exist.
Example Usage
local name = lia.option.getDisplayName("BarsAlwaysVisible")
print("Option name:", name)
lia.option.getDisplayDesc(key)
Purpose
Retrieve the localized description of an option entry.
When Called
When populating tooltips or description labels in the options UI.
Parameters
string key The option key to look up.
Returns
string Localized description string, or an empty string if none exists.
Example Usage
local desc = lia.option.getDisplayDesc("BarsAlwaysVisible")
print("Option description:", desc)
lia.option.getDisplayCategory(key)
Purpose
Retrieve the localized category of an option entry for grouping in the UI.
When Called
When building the options UI to sort entries into category sections.
Parameters
string key The option key to look up.
Returns
string Localized category name, or "misc" as the default fallback.
Example Usage
local cat = lia.option.getDisplayCategory("BarsAlwaysVisible")
print("Option category:", cat)
lia.option.getOptions(key)
Purpose
Resolve option choices (static or generated) for dropdowns.
When Called
By the config UI before rendering a Table option.
Parameters
string key
Returns
table Array/map of options.
Example Usage
local list = lia.option.getOptions("weaponSelectorPosition")
for _, opt in pairs(list) do print("Choice:", opt) end