-
Notifications
You must be signed in to change notification settings - Fork 4
Overview
Sinaloit edited this page May 27, 2014
·
2 revisions
##Addon Creation
GeminiAddon:NewAddon offers the same functionality that Apollo.RegisterAddon does and a little more.
GeminiAddon:NewAddon([oAddon ,] strAddonName, bConfigure[, tDependencies, [strPkgName, ...]])
-
oAddonis an optional argument where you can pass in a base object to use for the addon -
strAddonNameis required and the unique name for your addon -
bConfigureis also required and can be either a boolean or string value. If you pass it false, no Config button will be added to the ESC/options window. If you pass true, it will use thestrAddonNameas the button text. If you pass a string, it will use that as the button text. -
tDependenciesis an optional table that will contain a list of packages and addons that your addon depends upon. -
strPkgNameare packages that you would like to embed/mixin into the addon. The packages are required to support package embedding.
##Module Creation
GeminiAddon provides basic module support out of the box. If you are familiar with AceAddon, this should be very similar except that modules will not be extended to addon status. They will still get OnInitialize, OnEnable, and OnDisable callbacks however.
To create a module:
-- Create a module
local MyModule = MyAddon:NewModule("MyModule")
-- Create a module with some embedded packages
local MyModule = MyAddon:NewModule("MyModule", "PkgWithEmbed-1.0", "PkgWithEmbed2-1.0")
-- Create a module with a prototype
local oPrototype = { OnEnable = function(self) print("OnEnable called!") end }
local MyModule = MyAddon:NewModule("MyModule", oPrototype)To get a module you have created for the addon:
-- Get a module
local MyModule = MyAddon:GetModule("MyModule")Iterate over the modules in your addon:
for strModuleName, oModule in MyAddon:IterateModules() do
Print(oModule:GetName())
endDefault module state, prototypes and embeds can be specified though they will need to be done before any modules are created.