Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
m (→‎Result: and the award for not restarting indexes goes to...)
m (→‎Result: Oops.)
Line 17: Line 17:
 
)
 
)
 
===Result===
 
===Result===
File '\WTF\Account\(...)\SavedVariables\My Addon.lua' will look contain the MySavedVariables_Table variable, formatted something like this:
+
File '\WTF\Account\(...)\SavedVariables\My Addon.lua' will contain the MySavedVariables_Table variable, formatted something like this:
 
MySavedVariables_Table = {
 
MySavedVariables_Table = {
 
["ADDON_LOADED"] = {
 
["ADDON_LOADED"] = {

Revision as of 23:49, 8 January 2008

Registers a frame to receive all fired events; it is not advisable to use this for anything except debugging purposes, as the incurred performance penalty is quite large.

frame:RegisterAllEvents();

Example

-- Addon '\Interface\Addons\My Addon'
MySavedVariables_Table = {} -- Global (not PerCharacter) SavedVariable
local frame = CreateFrame('Frame')
frame:RegisterAllEvents()
frame:SetScript('OnEvent',
    function(self, event, ...)
        -- Save only the last instance of the fired event.
        MySavedVariables_Table[event] = {...};
    end
)

Result

File '\WTF\Account\(...)\SavedVariables\My Addon.lua' will contain the MySavedVariables_Table variable, formatted something like this:

MySavedVariables_Table = {
    ["ADDON_LOADED"] = {
        [1] = "Some other addon",
    },
    ["ADDON_ACTION_FORBIDDEN"] = {
        [1] = "Some other addon",
        [2] = "CastSpellByName",
    },
    ...
}