Comprehensive documentation for the ConfigDialog GUI rendering system.
- Overview
- Dialog Lifecycle
- Layout Types
- Opening and Closing Dialogs
- Navigation
- Widget Rendering
- Widget Pooling
- Blizzard Settings Integration
- Styling and Appearance
- Events
- API Reference
- Customization
- Troubleshooting
The ConfigDialog module transforms declarative options tables into interactive graphical user interfaces. It handles:
- Dialog window creation and management
- Layout rendering (tree, tab, inline)
- Widget creation for all option types
- User interaction handling
- Integration with WoW's Settings panel
- Performance optimization through widget pooling
+----------------------------------+
| ConfigDialog |
|----------------------------------|
| Dialog Management |
| - Create/Open/Close dialogs |
| - Track active dialogs |
|----------------------------------|
| Layout System |
| - Tree layout (sidebar + content)|
| - Tab layout (tabs + content) |
| - Simple layout (content only) |
|----------------------------------|
| Widget Rendering |
| - Type-specific renderers |
| - Widget pooling |
| - Event binding |
|----------------------------------|
| Blizzard Integration |
| - Settings panel registration |
| - Category management |
+----------------------------------+
local Loolib = LibStub("Loolib")
local ConfigDialogModule = Loolib:GetModule("ConfigDialog")
local Dialog = ConfigDialogModule.Dialog -- Singleton instance
-- Or through LoolibConfig
LoolibConfig:Open("MyAddon")RegisterOptionsTable()
|
v
Open(appName)
|
+-- Check if dialog exists
| |
| +-- Yes: Show existing
| |
| +-- No: CreateDialog()
| |
| +-- Create frame
| +-- Apply backdrop
| +-- Create title
| +-- Create close button
| +-- Create layout (tree/tab/simple)
| +-- Initial render
|
v
RefreshContent()
|
+-- Render navigation (tree/tabs)
+-- Get selected group
+-- Render options widgets
|
v
Dialog shown
+--------------------------------------------------+
| Title [X] |
+--------------------------------------------------+
| +----------+ +-----------------------------+ |
| | Tree | | Content Area | |
| | Nav | | | |
| | | | [Options render here] | |
| | > Gen | | | |
| | > App | | | |
| | > Adv | | | |
| | | | | |
| +----------+ +-----------------------------+ |
+--------------------------------------------------+
-- Dialog state stored per app
self.dialogs = {} -- appName -> dialog frame
self.selectedPaths = {} -- appName -> current selected path
self.blizPanels = {} -- appName -> Blizzard settings panel
self.defaultSizes = {} -- appName -> {width, height}Used when childGroups = "tree" (or default).
local options = {
type = "group",
name = "My Addon",
childGroups = "tree", -- Or omit for default
args = { ... }
}Visual Structure:
+-------+-------------------+
| Tree | Content |
+-------+-------------------+
|General| Group Title |
| +-Dis| Description... |
| +-Col| |
|Appear | [x] Option 1 |
|Modules| [x] Option 2 |
| | Scale: [===|==] |
+-------+-------------------+
Characteristics:
- Left sidebar (180px default) with scrollable tree
- Right content area with scrollable options
- Supports nested groups (indented in tree)
- Selected group highlighted in tree
Used when childGroups = "tab".
local options = {
type = "group",
name = "My Addon",
childGroups = "tab",
args = { ... }
}Visual Structure:
+---------------------------+
| [Gen] [Appear] [Modules] |
+---------------------------+
| Group Title |
| Description... |
| |
| [x] Option 1 |
| [x] Option 2 |
| Scale: [===|==] |
+---------------------------+
Characteristics:
- Horizontal tabs at top
- Selected tab highlighted
- Good for 3-5 top-level groups
- Not nested (only first level shows as tabs)
Used when no child groups or childGroups = "select".
local options = {
type = "group",
name = "My Addon",
childGroups = "select", -- Or no child groups
args = { ... }
}Visual Structure:
+---------------------------+
| Content fills entire |
| dialog area |
| |
| Options render directly |
+---------------------------+
Groups with inline = true render within their parent:
appearance = {
type = "group",
name = "Appearance",
args = {
colors = {
type = "group",
name = "Colors",
inline = true,
args = {
background = { type = "color", name = "Background" },
text = { type = "color", name = "Text" },
},
},
},
}Visual Structure:
+-----------------------------+
| Appearance |
+-----------------------------+
| +-------------------------+ |
| | Colors | |
| | Background: [##] | |
| | Text: [##] | |
| +-------------------------+ |
+-----------------------------+
-- Basic open
LoolibConfig:Open("MyAddon")
-- Open to specific group
LoolibConfig:Open("MyAddon", "appearance")
-- Open to nested group
LoolibConfig:Open("MyAddon", "appearance", "colors")
-- Direct dialog access
local dialog = ConfigDialogModule.Dialog:Open("MyAddon", nil, "appearance")-- Close specific dialog
LoolibConfig:Close("MyAddon")
-- Close all dialogs
LoolibConfig:Close()
-- Direct access
ConfigDialogModule.Dialog:Close("MyAddon")
ConfigDialogModule.Dialog:CloseAll()local dialog = ConfigDialogModule.Dialog.dialogs["MyAddon"]
if dialog and dialog:IsShown() then
-- Dialog is visible
endOpen within a parent frame:
local myFrame = CreateFrame("Frame", nil, UIParent)
myFrame:SetSize(800, 600)
myFrame:SetPoint("CENTER")
-- Dialog will be embedded in myFrame
local dialog = ConfigDialogModule.Dialog:Open("MyAddon", myFrame)-- Navigate to group
LoolibConfig:Open("MyAddon", "appearance")
-- After dialog open, change selection
ConfigDialogModule.Dialog:SelectGroup("MyAddon", "modules")
-- Navigate to nested group
ConfigDialogModule.Dialog:SelectGroup("MyAddon", "appearance", "colors")local currentPath = ConfigDialogModule.Dialog.selectedPaths["MyAddon"]
-- currentPath = {"appearance", "colors"} or {}-- Build your own navigation
local function GoToOption(appName, ...)
local Dialog = ConfigDialogModule.Dialog
-- Ensure dialog is open
if not Dialog.dialogs[appName] or not Dialog.dialogs[appName]:IsShown() then
Dialog:Open(appName, nil, ...)
else
Dialog:SelectGroup(appName, ...)
end
endConfigDialogModule.Dialog:RegisterCallback("OnGroupSelected", function(appName, ...)
local path = {...}
print("Selected:", table.concat(path, " > "))
end)RenderOptions(dialog, group, rootOptions, registry, path)
|
+-- Release existing widgets
|
+-- Render group header (if path > 0)
|
+-- Render group description
|
+-- For each option in sorted order:
|
+-- Skip if hidden
|
+-- If inline group: RenderInlineGroup()
|
+-- Else: RenderWidget()
|
+-- Dispatch to type-specific renderer:
- RenderHeader()
- RenderDescription()
- RenderToggle()
- RenderInput()
- RenderRange()
- RenderSelect()
- RenderMultiSelect()
- RenderColor()
- RenderExecute()
- RenderKeybinding()
- RenderTexture()
- RenderFont()
Each option type has a dedicated render function:
| Renderer | Creates | Notes |
|---|---|---|
RenderHeader |
FontString + Line | Section divider |
RenderDescription |
FontString | Static text, optional image |
RenderToggle |
CheckButton | UICheckButtonTemplate |
RenderInput |
EditBox + Label | BackdropTemplate for border |
RenderRange |
Slider + Label + Value | OptionsSliderTemplate |
RenderSelect |
Button + Popup Menu | Custom dropdown |
RenderMultiSelect |
Multiple CheckButtons | Grid layout |
RenderColor |
Button + Swatch | Opens ColorPickerFrame |
RenderExecute |
Button | UIPanelButtonTemplate |
RenderKeybinding |
Button + Capture | Custom capture logic |
RenderTexture |
Frame + Texture | Optional selection |
RenderFont |
Button + Popup Menu | Font preview in items |
local WIDTH_MULTIPLIERS = {
half = 0.5,
normal = 1.0,
double = 2.0,
full = 3.0,
}
-- Calculation
local widthMod = WIDTH_MULTIPLIERS[option.width] or WIDTH_MULTIPLIERS.normal
if option.width == "full" then
widthMod = contentWidth / LABEL_WIDTH
elseif type(option.width) == "number" then
widthMod = option.width
endlocal DIALOG_WIDTH = 700
local DIALOG_HEIGHT = 500
local TREE_WIDTH = 180
local CONTENT_PADDING = 16
local WIDGET_SPACING = 8
local LABEL_WIDTH = 200ConfigDialog uses frame pools to optimize performance.
self.widgetPools = {} -- type -> { inactive = {} }
-- Acquire from pool
function LoolibConfigDialogMixin:AcquireWidget(widgetType, parent, template, frameTypeOverride)
local pool = self.widgetPools[widgetType]
if not pool then
pool = { inactive = {} }
self.widgetPools[widgetType] = pool
end
local widget = table.remove(pool.inactive)
if not widget then
-- Create new widget
widget = CreateFrame(frameType, nil, parent, template)
widget.pooledWidgetType = widgetType
end
-- Reset and return
widget:SetParent(parent)
widget:Show()
widget:ClearAllPoints()
return widget
endfunction LoolibConfigDialogMixin:ReleaseWidgets(container)
local children = {container:GetChildren()}
for _, child in ipairs(children) do
-- Recursively release children
self:ReleaseWidgets(child)
if child.pooledWidgetType and self.widgetPools[child.pooledWidgetType] then
-- Clean up scripts
child:Hide()
child:ClearAllPoints()
child:SetScript("OnEnter", nil)
child:SetScript("OnLeave", nil)
child:SetScript("OnClick", nil)
-- ... more cleanup
-- Return to pool
table.insert(pool.inactive, child)
end
end
end"button""checkbutton""editbox""slider""scrollframe""group_frame"(for inline groups)
-- Add to root of Settings > Addons
LoolibConfig:AddToBlizOptions("MyAddon", "My Addon")
-- Add as sub-category
LoolibConfig:AddToBlizOptions("MyAddon", "Combat Module", "My Addon")
-- With path to specific group
LoolibConfig:AddToBlizOptions("MyAddon", "Colors", "My Addon", "appearance", "colors")function LoolibConfigDialogMixin:AddToBlizOptions(appName, name, parent, ...)
-- Create settings panel frame
local panel = CreateFrame("Frame", "LoolibBlizPanel_" .. appName, UIParent)
panel.name = name or appName
-- OnShow creates content
panel:SetScript("OnShow", function(self)
if not self.initialized then
self.initialized = true
-- Create title, description, "Open Config" button
end
end)
-- Register with WoW 10.0+ Settings API
if Settings and Settings.RegisterCanvasLayoutCategory then
local category
if parent then
local parentCategory = Settings.GetCategory(parent)
if parentCategory then
category = Settings.RegisterCanvasLayoutSubcategory(parentCategory, panel, panel.name)
end
end
if not category then
category = Settings.RegisterCanvasLayoutCategory(panel, panel.name)
end
Settings.RegisterAddOnCategory(category)
else
-- Legacy InterfaceOptions fallback
if parent then panel.parent = parent end
InterfaceOptions_AddCategory(panel)
end
return panel
endThe Blizzard Settings panel shows:
- Addon title
- Description (from options.desc)
- "Open Config" button - opens full dialog
-- WoW 10.0+
Settings.OpenToCategory("My Addon")
-- Legacy
InterfaceOptionsFrame_OpenToCategory("My Addon")Added in Loolib 2.1.0. Earlier consumers continue to render with the built-in default theme; no migration is required.
ConfigDialog ships with a sparse, layered theming system. Every color,
backdrop, and font that the renderer applies is resolved through a
DialogTheme table at render time. Consumers can:
- Override appearance for a specific app via
RegisterAppTheme(appName, ...) - Register named global themes via
RegisterDialogTheme(name, ...) - Replace whole widget creators via the
widgetFactoriestable - Post-style any created widget via the
afterCreateWidgethook
For any token (color, backdrop, font, layout), the resolver walks:
- Per-app override - whatever
RegisterAppTheme(appName, ...)provided - Active global theme - whatever
SetActiveDialogTheme(name)selected - Built-in default - the verbatim values from pre-2.1 ConfigDialog
A theme table is sparse: missing keys fall through transparently. This means consumers can override one color and inherit the rest.
{
colors = {
-- Surfaces
dialogBg, treeContainerBg, contentContainerBg, inlineGroupBg,
inputBg, inputBgDisabled, dropdownBg, dropdownBgDisabled,
dropdownMenuBg, filterButtonBg, filterMenuBg,
keyButtonBg, keyButtonBgDisabled, textureFrameBg, searchBoxBg,
-- Borders
treeContainerBorder, contentContainerBorder, inlineGroupBorder,
-- Tree / tab states
treeHoverBg, treeSelectionBg, treeTextSelected,
tabBgActive, tabBgInactive, tabActiveAccent,
tabTextActive, tabTextInactive,
-- Filter / dropdown highlights
filterButtonHover, dropdownItemHover, dropdownItemSelected,
-- Text
headerText, descriptionText, labelText, labelTextDisabled,
noResultsText, searchIcon,
-- Decorative
separator, textureMissing,
},
backdrops = {
dialog, container, input, popupMenu, inlineGroup, textureFrame,
-- Each is a Blizzard backdrop table:
-- { bgFile=..., edgeFile=..., tile=..., tileSize=..., edgeSize=..., insets={...} }
},
fonts = {
title, groupHeader, label, labelDisabled, description, treeNode,
-- Each is a font object name string (e.g. "GameFontNormal")
},
layout = {
dialogWidth, dialogHeight, treeWidth,
contentPadding, widgetSpacing, labelWidth,
},
-- Optional: replace the renderer's CreateFrame call for a widget type.
-- factory(dialog, parent, option, info) -> Frame
widgetFactories = {
toggle, range, input, select, multiselect, color,
execute, header, description, keybinding, texture, font,
},
-- Optional: post-style hook fired after every widget is created.
-- Receives (widgetType, widget, option, info). Use this to apply
-- a consistent skin without replacing widget creation.
afterCreateWidget = function(widgetType, widget, option, info) end,
}All keys are optional. The default theme provides values for everything.
This is the actual code Loothing uses to make its config dialog match the rest of the addon.
local Loolib = LibStub("Loolib")
local Config = Loolib.Config
local SkinningMixin = Loothing.SkinningMixin
-- Helper that pulls a color from Loothing's existing palette
local function GetSkinColor(key)
return SkinningMixin:GetColor(key)
end
local function RegisterTheme()
Config:RegisterAppTheme("Loothing", {
colors = {
dialogBg = GetSkinColor("frame"),
treeContainerBg = GetSkinColor("panelInset"),
treeContainerBorder = GetSkinColor("border"),
treeSelectionBg = GetSkinColor("rowSelected"),
treeHoverBg = GetSkinColor("rowHover"),
treeTextSelected = GetSkinColor("accent"),
contentContainerBg = GetSkinColor("panel"),
inlineGroupBg = GetSkinColor("panelAlt"),
inputBg = GetSkinColor("panelInset"),
dropdownBg = GetSkinColor("panelInset"),
dropdownMenuBg = GetSkinColor("panelInset"),
headerText = GetSkinColor("accent"),
labelText = GetSkinColor("text"),
descriptionText = GetSkinColor("textMuted"),
labelTextDisabled = GetSkinColor("textSubtle"),
tabActiveAccent = GetSkinColor("accent"),
separator = GetSkinColor("border"),
},
afterCreateWidget = function(widgetType, widget)
-- Apply Loothing's primary button style to every action button
if widgetType == "execute" then
SkinningMixin:StylePlainButton(widget, "primary")
end
end,
})
end
-- Register on init, and re-register when the user changes accent
RegisterTheme()
SkinningMixin:RegisterCallback("OnAccentChanged", RegisterTheme)RegisterAppTheme, RegisterDialogTheme, and SetActiveDialogTheme all
notify the dialog system. If a dialog for the affected app is currently
open, it is refreshed in place — no need to close and reopen.
Config:RegisterAppTheme(appName, themeTable) -- per-app override
Config:RegisterDialogTheme(themeName, themeTable) -- named global theme
Config:SetActiveDialogTheme(themeName) -- switch global default
Config:GetDialogTheme(appName) -- resolved theme tableNote: as of Loolib 2.1.0, every value in this section is the default theme. To override any of them, use the theming API documented above. The hardcoded sections below remain for reference on what the dialog looks like out of the box.
dialog:SetBackdrop({
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background-Dark",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = true, tileSize = 32, edgeSize = 32,
insets = {left = 11, right = 12, top = 12, bottom = 11}
})treeContainer:SetBackdrop({
bgFile = "Interface\\Buttons\\WHITE8X8",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = {left = 3, right = 3, top = 3, bottom = 3}
})
treeContainer:SetBackdropColor(0.1, 0.1, 0.1, 0.8)
treeContainer:SetBackdropBorderColor(0.4, 0.4, 0.4, 1)optionsContainer:SetBackdrop({
bgFile = "Interface\\Buttons\\WHITE8X8",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = {left = 3, right = 3, top = 3, bottom = 3}
})
optionsContainer:SetBackdropColor(0.1, 0.1, 0.1, 0.6)
optionsContainer:SetBackdropBorderColor(0.4, 0.4, 0.4, 1)groupFrame:SetBackdrop({
bgFile = "Interface\\Buttons\\WHITE8X8",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 12,
insets = {left = 2, right = 2, top = 2, bottom = 2}
})
groupFrame:SetBackdropColor(0.15, 0.15, 0.2, 0.5)
groupFrame:SetBackdropBorderColor(0.5, 0.5, 0.5, 0.8)-- Before opening
ConfigDialogModule.Dialog:SetDefaultSize("MyAddon", 800, 600)
-- Then open
LoolibConfig:Open("MyAddon")| Element | Color |
|---|---|
| Background | (0.1, 0.1, 0.1) |
| Tree background | (0.1, 0.1, 0.1, 0.8) |
| Content background | (0.1, 0.1, 0.1, 0.6) |
| Inline group | (0.15, 0.15, 0.2, 0.5) |
| Border | (0.4, 0.4, 0.4) to (0.6, 0.6, 0.6) |
| Selection highlight | (0.2, 0.4, 0.6, 0.8) |
| Hover highlight | (0.3, 0.3, 0.5, 0.5) |
| Header text | Gold (1, 0.82, 0) |
| Selected text | Yellow (1, 1, 0) |
| Disabled text | Gray (0.5, 0.5, 0.5) |
| Event | Parameters | Description |
|---|---|---|
OnDialogOpened |
appName | Dialog opened |
OnDialogClosed |
appName | Dialog closed |
OnGroupSelected |
appName, path... | Group navigation |
OnOptionChanged |
appName, path..., value | Option value changed |
local Dialog = ConfigDialogModule.Dialog
-- On dialog open
Dialog:RegisterCallback("OnDialogOpened", function(appName)
print("Config opened for:", appName)
end)
-- On dialog close
Dialog:RegisterCallback("OnDialogClosed", function(appName)
print("Config closed for:", appName)
end)
-- On navigation
Dialog:RegisterCallback("OnGroupSelected", function(appName, ...)
local path = {...}
print("Navigated to:", table.concat(path, " > "))
end)
-- With specific owner
local myFrame = CreateFrame("Frame")
Dialog:RegisterCallback("OnDialogOpened", function(appName)
-- Handler code
end, myFrame)
-- Unregister
Dialog:UnregisterCallback("OnDialogOpened", myFrame)The dialog also listens for config changes:
-- Trigger refresh when options change
LoolibConfig:NotifyChange("MyAddon")
-- Or directly
ConfigRegistryModule.Registry:NotifyChange("MyAddon")The dialog singleton instance provides these methods:
function LoolibConfigDialogMixin:Init()Initialize the dialog system. Called automatically.
function LoolibConfigDialogMixin:Open(appName, container, ...)Open configuration dialog.
| Parameter | Type | Description |
|---|---|---|
appName |
string | Registered app name |
container |
Frame | Optional parent (nil = standalone) |
... |
strings | Optional path to group |
Returns: Frame - Dialog frame
function LoolibConfigDialogMixin:Close(appName)Close dialog for specific app.
function LoolibConfigDialogMixin:CloseAll()Close all open dialogs.
function LoolibConfigDialogMixin:SelectGroup(appName, ...)Navigate to specific group.
| Parameter | Type | Description |
|---|---|---|
appName |
string | App name |
... |
strings | Path components |
Returns: boolean - Success
function LoolibConfigDialogMixin:SetDefaultSize(appName, width, height)Set default dialog dimensions.
| Parameter | Type | Description |
|---|---|---|
appName |
string | App name |
width |
number | Width in pixels |
height |
number | Height in pixels |
function LoolibConfigDialogMixin:AddToBlizOptions(appName, name, parent, ...)Add to Blizzard Settings panel.
| Parameter | Type | Description |
|---|---|---|
appName |
string | App name |
name |
string | Display name |
parent |
string | Parent category (optional) |
... |
strings | Path to group (optional) |
Returns: Frame - Settings panel frame
function LoolibConfigDialogMixin:RefreshContent(appName)Refresh dialog content for app.
function LoolibConfigDialogMixin:AcquireWidget(widgetType, parent, template, frameTypeOverride)Get widget from pool or create new.
function LoolibConfigDialogMixin:ReleaseWidgets(container)Release all widgets in container back to pools.
Each type has a render function returning new yOffset:
function LoolibConfigDialogMixin:RenderHeader(parent, name, yOffset, contentWidth)
function LoolibConfigDialogMixin:RenderDescription(parent, option, name, desc, yOffset, contentWidth)
function LoolibConfigDialogMixin:RenderToggle(parent, option, name, desc, registry, info, disabled, yOffset)
function LoolibConfigDialogMixin:RenderInput(parent, option, name, desc, registry, info, disabled, yOffset, widthMod)
function LoolibConfigDialogMixin:RenderRange(parent, option, name, desc, registry, info, disabled, yOffset, widthMod)
function LoolibConfigDialogMixin:RenderSelect(parent, option, name, desc, registry, info, disabled, yOffset, widthMod)
function LoolibConfigDialogMixin:RenderMultiSelect(parent, option, name, desc, registry, info, disabled, yOffset, contentWidth)
function LoolibConfigDialogMixin:RenderColor(parent, option, name, desc, registry, info, disabled, yOffset)
function LoolibConfigDialogMixin:RenderExecute(parent, option, name, desc, registry, info, disabled, yOffset, widthMod)
function LoolibConfigDialogMixin:RenderKeybinding(parent, option, name, desc, registry, info, disabled, yOffset)
function LoolibConfigDialogMixin:RenderTexture(parent, option, name, desc, registry, info, disabled, yOffset, widthMod)
function LoolibConfigDialogMixin:RenderFont(parent, option, name, desc, registry, info, disabled, yOffset, widthMod)
function LoolibConfigDialogMixin:RenderInlineGroup(parent, group, rootOptions, registry, path, yOffset, contentWidth, appName)The title comes from options.name:
local options = {
type = "group",
name = "My Custom Title", -- This appears in title bar
args = { ... }
}Dynamic title:
name = function(info)
return "My Addon v" .. GetAddOnMetadata("MyAddon", "Version")
end,-- Before first open
ConfigDialogModule.Dialog:SetDefaultSize("MyAddon", 900, 700)Listen for dialog open to customize:
ConfigDialogModule.Dialog:RegisterCallback("OnDialogOpened", function(appName)
if appName == "MyAddon" then
local dialog = ConfigDialogModule.Dialog.dialogs[appName]
-- Customize dialog frame
dialog:SetFrameStrata("FULLSCREEN")
end
end)Force refresh when your addon state changes:
function MyAddon:OnStateChange()
-- Update your data
self.db.state = newState
-- Refresh config dialog if open
if ConfigDialogModule.Dialog.dialogs["MyAddon"] then
ConfigDialogModule.Dialog:RefreshContent("MyAddon")
end
end-- Check if options registered
if not LoolibConfig:IsRegistered("MyAddon") then
print("Options not registered!")
end
-- Check for errors in options table
local options = LoolibConfig:GetOptionsTable("MyAddon")
if not options then
print("Failed to get options table")
end-- Ensure args table exists
local options = {
type = "group",
name = "Test",
args = {}, -- Must exist, even if empty
}
-- Check hidden property
{
type = "toggle",
name = "Test",
hidden = function(info)
print("Hidden check called")
return false
end,
}-- Make sure to notify changes
LoolibConfig:NotifyChange("MyAddon")
-- Check that get/set work correctly
get = function(info)
local value = db.setting
print("Get called, value:", value)
return value
end,-- Ensure dialogs are properly closed
-- Widget pooling should handle most cases
-- If you create custom widgets, clean them up:
dialog:SetScript("OnHide", function()
-- Cleanup code
end)- Avoid expensive operations in get/set functions
- Cache dynamic values when possible
- Use static values where dynamic not needed
- Minimize NotifyChange calls
-- Bad: expensive in get
get = function()
local items = {}
for i = 1, 1000 do
items[i] = GetItemInfo(i) -- API call each time!
end
return items
end,
-- Good: cache results
local itemCache
values = function()
if not itemCache then
itemCache = {}
-- Build once
end
return itemCache
end,- Config.md - Main configuration system documentation
- ConfigTypes.md - Option type reference