WoW:USERAPI SetAddOnDetail

From AddOn Studio
Jump to navigation Jump to search
This page documents a <i>user-defined API</i> that is provided by third-party addons.

AddOn defined functions < SetAddOnDetail

The intent of this page is to provide a simple, consistent API for modular AddOn inclusions to register their details. Currently in WoW, there are functions to query details of loaded AddOns. However for embedded AddOns, they don't appear anywhere. Any addons that are interested in registering their details are asked to call the following function, and any addons that are interested in what addons are loaded are asked to hook the following function:

SetAddOnDetail(name, detail)

Parameters[edit]

Arguments[edit]

name
String - The name of the AddOn being defined (should be the same as the name would be if running standalone)
detail
Table - Contains the detail for the various pieces of detail about the addon.

The detail table structure[edit]

The detail table contains optional pieces of information in the same meaning and sense that they are used in the TOC File (except in lowercase), including but not limited to:

version
The version of the AddOn.
title
This text is what is displayed in the AddOns list located during user selection.
notes
The message that appears under the AddOn name when you mouseover the name of the AddOn in the WoW AddOns list.

Hooking Procedure[edit]

For addons that want to monitor the submitted details, the following code is the recommended procedure to create the function:

-- Define a blank stub if the function doesn't exist.
if not _G['SetAddOnDetail'] then
	_G['SetAddOnDetail'] = function(name, detail) end
end

-- Define my functions to process the information.
local myRegistry = {}
local function myAddOnDetail(name, detail)
	myRegisty[name] = detail
end

-- Post hook the global SetAddOnDetail function.
hooksecurefunc("SetAddOnDetail", myAddOnDetail)

Example Code[edit]

The following code snippets illustrate how to register your AddOn's details via the SetAddOnDetail function.

if SetAddOnDetail then
	SetAddOnDetail("myAddOn", {
		version = "1.0",
		title = "My AddOn",
		notes = "An addon to demonstrate the use of the SetAddOnDetail() function",
	})
end

Addons[edit]

This function is implemented by the following addons:

AddOns using this function: