Dongle/API

self:NewModule([obj, ]name)
Creates a new module. This module's Initialize or Enable will be called after it's parent's Initialize or Enable is called.

Args

 * obj [Table]
 * The table to populate with our functions. If not provided, a new blank table will be created and returned.


 * name [String]
 * The name of our module. This must be unique in the Dongle registry, so you should probably append the parent dongle's name.  For example: "SampleAddon-SampleModule"

Returns

 * obj [Table]
 * Table populated with or functions.


 * name [String]
 * Name of the module

self:HasModule(name)
Query to see if we have a module

Args

 * name [String]
 * Name of the module we wish to lookup

Returns

 * obj [Table or nil]
 * The module's object, if found

self:IterateModules
Iterates over the addon's module names (not objects).

Example
for name in self:IterateModules do  local o = self:HasModule(name) ... end

self:RegisterEvent(event[, func])
Registers an event handler.

Args

 * event [String]
 * The event you are registering for


 * func [String, function or nil]
 * The function to be called.
 * If string, self[func](self, event, ...) is called
 * If function, func(event, ...) is called
 * If nil, self[event](self, event, ...) is called

self:UnregisterEvent(event)
Unregisters an event handler.

Args

 * event [String]
 * The event you are unregistering from

self:UnregisterAllEvents
Unregisers all event handlers for your dongle.

self:TriggerEvent(event, ...)
Triggers a custom event. Only other dongles can catch this event.

Args

 * event [String]
 * The name of the event you are firing


 * args to be passed to event handlers
 * args to be passed to event handlers