Initially, it was hoped that GreenWall could be extended to bridge
standard add-on messages. However, the WoW API doesn't have a function
similar to ChatFrame_MessageEventHandler
that could be used
for add-on messages.
So this simple messaging API is provided for third-party add-on developers
who would like to be able to use the bridged communication on a guild
confederation.
Before any API functions are called, there are two tests that should be
run to verify the environment.
if IsAddOnLoaded('GreenWall') then
...
end
if GreenWallAPI ~= nil then
...
end
To send a message to other instances of the add-on, use the following function.
GreenWallAPI.SendMessage(addon, message)
The addon parameter is either the name of the add-on or '*', which matches
from any add-on.
The receiving of messages is handled with callbacks.
local function handler(addon, sender, echo, message)
The function should accept the following arguments:
local id = GreenWallAPI.AddMessageHandler(handler, addon, priority)
*
character can be used to match all add-ons.In addition to the GreenWallAPI.AddMessageHandler
function to add a handler,
the following functions are available to manage the dispatch table.
local found = GreenWallAPI.RemoveMessageHandler(id)
GreenWallAPI.ClearMessageHandlers(addon)
*
character can be used to match all add-ons. If this
value is nil
, all entries will be cleared.Note: A
*
value passed as add-on is not a wildcard in this context, it will only matched instances where the handler was installed with*
as the add-on.