about SendAddonMessage()
As i have read the discussion in the official forums i have think about resolving the sending addon. As slouken said they wil not include an arg to give the identifier of the addon so it looks like we should make that by our own.
There is a suggestion for the identifier:
The first [TBD] bytes hold the identifier of the addon that have send the message. So if you get the message you can cut the identifier by using string.sub(arg1,1,[TBD]) and then compare it with the global ID of your addon.
sample code:
if event == "CHAT_MSG_ADDON" then
local id = string.sub(arg1,1,LENGTH);
if id == MyAddOnID then
local msg = string.sub(arg1,LENGTH+1);
MyAddOn_ParseMessage(msg);
end
end
LENGTH will the count of bytes you need for the identifier.
It will be best, when all addons took an agreement with the length and the type of identifier so it will be more clear to know what is the identifier.
[TBD] - To be defined
|