Quote Originally Posted by ZorbaTHut View Post
Event tables are nothing more complicated than Lua tables. When the event is triggered, we run through the table in order and call the events. Inserting an event into a table is just table.insert(), removing an event would be table.remove(), though in both cases you'll need to get the Lua syntax right - I hate to say it but none of the examples you've posted are syntactically valid.Here's an example of handling that particular event properly:
Code:
local function testfunc(addonname)  print("Variables about to be saved for", addonname)endtable.insert(Event.Addon.SavedVariables.Load.Begin, {testfunc, "MyAddon", "Saved Variables"})
testfunc will have a single parameter passed to it: the name of the addon whose SavedVariables are about to be loaded."nil" is not a valid function and will cause errors. If you want to remove an event handler later, you'll want to entirely remove that element from the event table.Events require the addon identifier for identification and tracking purposes. There's no way we can know which addon is responsible for a specific event otherwise, so we use that information to track CPU usage and give better error diagnostics. It's also intended for outside addons to be able to re-hook events easily - if you want to modify ZorbasBuffBars from your own addon, you can just look for the event hook with the addon identifier set to "ZorbasBuffBars".If you still have questions, let me know
Jump to post...