Quantcast
Download
(4 Kb)
Download
Updated: 09/22/14 02:38 PM
Compatibility:
Update 4 (1.4.3)
Update 3 (1.3.3)
Updated:09/22/14 02:38 PM
Created:09/22/14 02:38 PM
Monthly downloads:986
Total downloads:6,659
Favorites:1
MD5:
Categories:Libraries, Developer Utilities
Addon Manager  Popular! (More than 5000 hits)
Version: 1.0
by: w33zl [More]
Addon Manager simplifies registration of addons, and also adds to unifying the addon structure. All registered addon will follow this structure:

Code:
object.Addon.Name -- Unique addon name
object.Addon.Version -- A version identifier (typically a string in the format {major}.{minor}.{revision})
object.Addon.Author -- The name of the addon author
object.Addon.Name -- A description of the addon
In addition to the structure above all addons will have two events (functions) ready to be used:

Code:
object:OnLoad -- Gets fired as soon as this addon is being loaded (typically where you prepare your addon)
object:OnReady -- Gets fired as soon as the player is ready (now we know the player is ready to recieve messages and such)
If you have defined the OnLoad function (this is optional) a message will be added to the chat window when the OnLoad function has completed execution. This message will be as follows:

{addonName} {version} loaded!

To disable the automatic loaded message you can set SupressLoadMessage to true before you register the OnLoad function:

Code:
object.SupressLoadMessage = true

Installation:
--------------
  1. Copy ADDONS.lua to a subfolder of your add-on (/lib/ for example)
  2. Add a new line in your manifest file (.txt):
    lib/ADDONS.lua
  3. Now Addon Manager is ready


Usage:
--------

There is two ways to register an new addon:

A) Create a new Addon class (this will create a new table):

Code:
local fooAddon = ADDONS:Create("FooAddon", "0.1.0", "author", "description")
B) Register an existing table as a Addon class:

Code:
    local fooAddon
    ADDONS:Register(fooAddon, "FooAddon", "0.1.0", "author", "description")
Note: Author and Description are both optional parameters


Should you need to check if a addon is registered, or you need to get your addon from another LUA filer, simply call "Get":

Code:
    local fooAddon = ADDONS:Get("FooAddon")

Example:
-----------

Code:
local fooAddon = ADDONS:Create("FooAddon", "0.1.0", "author", "description")

function fooAddon:OnLoad()
    d("Addon " .. self.Addon.Name .. " is being loaded")
end    

function fooAddon:OnReady()
    d("And now we are ready!")
end

API Documentation:
------------------------

Warning: Spoiler
Optional Files (0)


There have been no comments posted to this file.
Be the first to add one.



Category Jump: