Skip to content

Exposed Methods on LAM2

Baertram edited this page Aug 27, 2021 · 3 revisions

REGISTER ADDON PANEL

Registers your addon with LibAddonMenu and creates a panel

:RegisterAddonPanel(addonID, panelData)

Usage:

addonID = "string"; unique ID which will be the global name of your panel
panelData = table; data object for your panel - see controls\panel.lua

Returns:

panel = userdata; a reference to the created addon panel

REGISTER OPTION CONTROLS

Registers the options you want shown for your addon. These are stored in a table where each key-value pair is the order of the options in the panel and the data for that control, respectively. See exampleoptions.lua for an example. See controls<widget>.lua for each widget type

:RegisterOptionControls(addonID, optionsTable)

Usage:

addonID = "string"; the same string passed to :RegisterAddonPanel
optionsTable = table; the table containing all of the options controls and their data

OPEN TO ADDON PANEL

Opens to a specific addon's option panel.

:OpenToPanel(panel)

Usage:

panel = userdata; the panel returned by the :RegisterAddonPanel method

REGISTER WIDGET (advanced)

Each widget has its version checked before loading, so we only have the most recent one in memory.

:RegisterWidget(widgetType, widgetVersion)

Usage:

widgetType = "string"; the type of widget being registered
widgetVersion = integer; the widget's version number

CREATE CONTROL (advanced)

For manual control creation. You must handle anchoring of these controls, either to a LAM panel or a control of your choosing.

LAMCreateControl[widgetType](parent, widgetData, widgetName)

Usage:

widgetType = “string”; the type of widget to be created
parent = userdata; the panel returned by the :RegisterOptionsPanel method
widgetData = table; the table containing the widget’s data
widgetName = “string”; a unique global reference for your control (optional)

Returns:

widget = userdata; a reference to the control created