View Single Post
09-01-16, 09:26 AM   #5
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
My take on an event handler:
https://github.com/p3lim-wow/Inomena...ore/events.lua

Code:
-- this will register and assign a method in the function creation itself, handled by metatables
function E:PLAYER_LOGIN()
    -- do something
    return true -- unregister
end

-- also normal functionality
E:RegisterEvent('PLAYER_LOGIN', methodName)
E:UnregisterEvent('PLAYER_LOGIN', methodName)

-- manually execute all methods for an event
E:Call('PLAYER_LOGIN', arg1, arg2, ...)
No support for unit events tho'

Last edited by p3lim : 09-01-16 at 09:32 AM.
  Reply With Quote