Fandom

WoWWiki

Dongle/API

< Dongle

104,642pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Addonicon
WoWWiki Hosted AddOn Sub-Page
Dongle » API

self:NewModule([obj, ]name) Edit

Creates a new module. This module's Initialize or Enable will be called after it's parent's Initialize or Enable is called.

Args Edit

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 Edit

obj [Table]
Table populated with or functions.
name [String]
Name of the module

self:HasModule(name) Edit

Query to see if we have a module

Args Edit

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

Returns Edit

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

self:IterateModules() Edit

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

Example Edit

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

self:RegisterEvent(event[, func]) Edit

Registers an event handler.

Args Edit

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) Edit

Unregisters an event handler.

Args Edit

event [String]
The event you are unregistering from

self:UnregisterAllEvents() Edit

Unregisers all event handlers for your dongle.

self:TriggerEvent(event, ...) Edit

Triggers a custom event. Only other dongles can catch this event.

Args Edit

event [String]
The name of the event you are firing
...
args to be passed to event handlers

Also on Fandom

Random Wiki