Skip to content

Addon API

ArcaneWizardLibrary is the public global exposed by the library. This page covers the addon-specific API: create an addon context, then call methods on the returned addon object.

ArcaneWizardLibrary.Settings, ArcaneWizardLibrary.Dialogs, ArcaneWizardLibrary.Controls, ArcaneWizardLibrary.Windows, and ArcaneWizardLibrary.Utils are static namespaces and are documented on their own API pages.

Reusable close-button and action-button XML templates are documented under Button Templates.

Reusable checkboxes and option groups are documented under Controls Static API.

Metadata

FieldTypeDescription
ADDON_AUTHORstringAuthor from the library .toc.
ADDON_VERSIONstringLibrary version from the library .toc.
ADDON_BUILD_DATEstringBuild date from X-BuildDate.
ADDON_REVISIONstringRevision from X-Revision.
GAME_VERSIONstringCurrent WoW build string from GetBuildInfo().
GAME_FLAVORstringHuman-readable flavor name.
GAME_TYPE_VANILLAbooleantrue on Classic Era.
GAME_TYPE_TBCbooleantrue on Burning Crusade - Classic Anniversary Edition.
GAME_TYPE_MISTSbooleantrue on Mists of Pandaria - Classic.
GAME_TYPE_MAINLINEbooleantrue on Retail.

Namespaces

NamespaceDescription
ArcaneWizardLibrary.UtilsGeneral utility helpers.
ArcaneWizardLibrary.DialogsStatic popup helpers.
ArcaneWizardLibrary.ControlsConsistently styled selection controls.
ArcaneWizardLibrary.SettingsBlizzard settings helpers.
ArcaneWizardLibrary.WindowsScalable window and popup helpers.

ArcaneWizardLibrary:NewAddon(addonName)

Creates or returns the addon context for addonName. This context is the main object a consuming addon uses for addon-specific helpers.

lua
local addon = ArcaneWizardLibrary:NewAddon("MyAddon")

Parameters

NameTypeRequiredDescription
addonNamestringYesThe addon's folder name.

This function asserts if addonName is not a non-empty string.

Returns

ArcaneWizardLibraryAddon

ArcaneWizardLibrary:GetAddon(addonName)

Returns an existing addon context.

lua
local addon = ArcaneWizardLibrary:GetAddon("MyAddon")

This function asserts if no context has been created for the given addon name.

Addon context

Addon contexts are created with ArcaneWizardLibrary:NewAddon(addonName) and returned by ArcaneWizardLibrary:GetAddon(addonName).

Fields

FieldTypeDescription
namestringAddon folder name.
versionstring | nilAddon version from .toc metadata.
buildDatestring | nilAddon build date from X-BuildDate.
mediaPathstringBase path to the addon's assets folder.
mainCategoryIdnumber | nilStored Blizzard settings category ID.

addon:GetMediaPath(fileName)

Returns the base media path or a specific file path below it.

lua
local icon = addon:GetMediaPath("icon-round.blp")

addon:SetMainCategoryId(categoryId)

Stores the Blizzard settings category ID for later use with OpenCategory.

lua
addon:SetMainCategoryId(category:GetID())

addon:OpenCategory()

Opens the stored settings category when combat lockdown does not block it.

Returns true when the category was opened and false when combat lockdown blocks opening the options menu.

This function asserts when no category ID has been stored with SetMainCategoryId, because that indicates an addon integration error.

addon:ShowUpdateNotice(show)

Writes a localized update notice to the chat for the addon's current .toc version when show is true.

lua
if addon:ShowUpdateNotice(MyAddonDB.showUpdateNotice) then
  MyAddonDB.showUpdateNotice = false
end

The function returns true when the chat message was written and false when show is false. The consuming addon is responsible for deciding when the Boolean becomes true and for storing its state in account-wide SavedVariables.

addon:RegisterMinimapButton(config)

Registers a LibDataBroker minimap button and returns the LibDBIcon instance.

The launcher tooltip shows the addon name and includes version and buildDate when the corresponding optional addon metadata is available. Missing metadata is omitted.

Config fieldTypeRequiredDefaultDescription
dbtableNoNoneLibDBIcon configuration table used to store visibility and minimap position.
tooltipstring | string[]NoNoneOne tooltip line or a list of tooltip lines displayed below the addon metadata.
iconFileNamestringNoicon-round.blpFile name below the addon's assets folder used as the launcher icon.
onLeftClickfunctionNoNoneCallback invoked when the launcher is left-clicked. A right-click opens the addon's settings category.

addon:CreateCompartmentHandlers(config)

Creates a table with OnEnter, OnLeave, and OnClick handlers for AddonCompartment integration.

The AddonCompartment tooltip uses the same optional version and buildDate metadata as the minimap launcher.

Config fieldTypeRequiredDefaultDescription
tooltipstring | string[]NoNoneOne tooltip line or a list of tooltip lines displayed below the addon metadata.
onLeftClickfunctionNoNoneCallback invoked when the compartment entry is left-clicked. A right-click opens the addon's settings category.

Built with VitePress (MIT License).