AceAddon-3.0 Documentation

Getting a hold of AceAddon:

local AceAddon = LibStub:GetLibrary("AceAddon-3.0")
local AceAddon = LibStub("AceAddon-3.0")

or create an addon object immediately:

local myAddon = LibStub("AceAddon-3.0"):NewAddon("myAddon", ... )


AceAddon API


AceAddon:NewAddon( name, [lib, lib, lib, ...] )
	name (string) - unique addon object name
	[lib] (string) - optional libs to embed in the addon object
returns the addon object when succesful

Example:
	local myAddon = LibStub("AceAddon-3.0"):NewAddon("myAddon", "AceEvent-3.0", "AceDB-3.0", "SomeLib-1.0")
myAddon is now an Ace addon object with AceEvent-3.0, AceDB-3.0 and SomeLib-1.0 mixed into the object.


AceAddon:GetAddon( name, [silent])
	name (string) - unique addon object name
	silent (boolean) - if true, addon is optional, silently return nil if its not found
returns the addon object if found


AceAddon:EmbedLibraries( addon, [lib, lib, lib, ...] )
	addon (object) - addon to embed the libs in
	[lib] (string) - optional libs to embed
Embeds the given libraries into the addon object.

AceAddon:EmbedLibrary( addon, libname, silent, offset )
	addon (object) - addon to embed the libs in
	libname (string) - lib to embed
	[silent] (boolean) - optional, marks an embed to fail silently if the library doesn't exist.
	[offset] (number) - will push the error messages back to said offset defaults to 2
Embeds one library into the addon object.


AceAddon:IntializeAddon( addon )
	addon (object) - addon to intialize
Mostly an internal function. Typical developers will not use this. IntializeAddon is called on the addon upon ADDON_LOADED automatically.
	calls OnInitialize on the addon object if available
	calls OnEmbedInitialize on embedded libs in the addon object if available


AceAddon:EnableAddon( addon )
	addon (object) - addon to enable
This function enables the addon object. This is automatically called upon PLAYER_LOGIN or sequentially after ADDON_LOADED when PLAYER_LOGIN has already fired and the addon is LoD.
	calls OnEnable on the addon object if available
	calls OnEmbedEnable on embedded libs in the addon object if available


AceAddon:DisableAddon( addon )
	addon (object) - addon to disable
Disables the addon object. This can be used for a soft disable of modules/addons.
	calls OnDisable on the addon object if available
	calls OnEmbedDisable on embedded libs in the addon object if available


AceAddon:IterateAddons()
Returns an iterator over all registered AceAddons.

AceAddon:IterateEmbedsOnAddon( addon )
Returns an iterator over all embedded libraries in the passed addon.

AceAddon:IterateAddonStatus()
Returns an iterator over all addons and their status [name] => [status]

AceAddon:IterateModulesOfAddon( addon )
Returns an iterator over all modules of an addon. [name] => [moduleobject]




Addon Object API

addon:GetModule( name, [silent])
	name (string) - unique module object name
	silent (boolean) - if true, module is optional, silently return nil if its not found
returns the module object if found

addon:NewModule( name, [prototype, [lib, lib, lib, ...] )
	name (string) - unique module object name for this addon
	prototype (object) - object to derive this module from, methods and values from this table will be mixed into the module, if a string is passed a lib is assumed
	[lib] (string) - optional libs to embed in the addon object
returns the addon object when succesful
Modules of an AceAddon are AceAddon objects themselves and thus have the same API.

addon:Enable()
Enables the addon and returns true or false depending on success
If the addon is already enabled this will return false

addon:Disable()
Disables teh addon and returns true or false depending on success
If the addon is already disabled this will return false

addon:EnableModule( name )
	name (string) - unique module object name to enable
returns true or false depending on success
	
addon:DisableModule( name )
	name (string) - unique module object name to disable
returns true or false depending on success

addon:IsEnabled()
return true or false depending on wether the addon is enabled or not.

addon:IsModule()
returns true or false depending on wether the addon is a module or not.


addon:SetDefaultModuleLibraries( [lib, lib, lib, ...]  )
	[lib] (string) - libs to embed in every module


addon:SetDefaultModuleState( state )
	state (boolean) - default state for new modules (enabled=true, disabled=false)

addon:SetDefaultModulePrototype( prototype )
	prototype (table) - default prototype to use for modules.

addon:SetEnabledState ( state )
	state ( boolean ) - set the state of an addon or module  (enabled=true, disabled=false)
should only be called before any Enabling actually happend, aka in OnInitialize


addon:IterateModules()
Iterates over the modules of the current addon object

addon:IterateEmbeds()
Iterates over the embedded libraries of the addon object

-- Special optional functions

addon:OnInitalize()
If this function is defined on your addon object it will be called when it is initialized. Typically on ADDON_LOADED.

addon:OnEnable()
If this function is defined on your addon object it will be called when it is enabled. Typically on PLAYER_LOGIN

addon:OnDisable()
If this function is defined on your addon object it will be called when it is disabled.

addon:OnModuleCreated( module )
If this function is defined on your addon object it will be called whenever a new module is added through NewModule. The module object is passed.
