Change Log:
1.2.5 (23-02-10)
+ Fixed a bug in the scheduling system.
+ Made some minor improvements to the scheduling system.
+ The error messages were modified to make them more readable.
+ Made a minor update to the documentation.
1.2 (20-02-10)
+ Fixed some args check.
+ Fixed some documentation errors.
+ Added a method to register multiple events with a single handler.
+ Added a method to unregister multiple events.
+ The name of the event is now being passed to all event handlers as a second argument!
1.1 (18-02-10)
+ Fixed the assertion level on some calls.
+ Added binary heap to handle tasks scheduling.
1.0.1 (17-02-10)
+ Fixed the 'ToColorString(...)' function to return the correct results.
+ Fixed a bug that made custom events shared across all addons.
Description:
A simple library that provides a common interface and functionality for addons.
This is a very lightweight library.
Usage
local magic = LibStub("MagicLib-1.0"):New("name")
local module = magic:NewModule("moduleName")
You can use your own table, as follow.
local myTable = { }
local magic = LibStub("MagicLib-1.0"):New("name", myTable)
local module = myTable:NewModule("moduleName")
Modules Interface
NewModule(name) - Create a new module.
Arguments.
name - (string) The name of the module.
inherit - (string, table) A module name, or an actual module for this module to derive from.
config - (table) A configuration table we may want to associate to this module.
Returns.
module - (table) A module.
config - (table) The configuration table the module is associated with.
GetModule(name) - Gets the given module.
Arguments.
name - (string) The name of the module.
Returns.
module - (table) A module.
config - (table) The configuration table the module is associated with.
NewInstance(name, ...) - Create an instance of a module.
Arguments.
name - (string) The name of the module.
args - (table) An arbitrarily list of arguments.
Returns.
instance - (table) An instance of the given module.
config - (table) The configuration table the module is associated with.
Usage.
local magic = LibStub("MagicLib-1.0"):New("name")
-- Defines a type, essentially a class.
local t = magic:NewModule("typeName")
function t:ctor(param1, ...)
end
-- Creates an instance of the class.
local objName = magic:NewInstance("typeName", arg1, ...)
IterateModules() - Traverse through all modules.
Modules Functionality
GetName() - Gets the name of the module.
Returns.
name - (string) The name of the module.... |
|