View Single Post
08-26-14, 09:29 PM   #25
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Sharparam View Post
... having events be dynamically (un)registered based on new keys, something like this gist. Doing that to an object from CreateFrame is certainly possible, but is it wise to alter its metatable?
No. Altering the metatables of Blizzard UI object types is not recommended. Also, I'm not sure I see any benefit in that particular example -- dynamically adding and removing event-handling methods to your frame seems rather convoluted, and potentially very wasteful. It's much simpler to just define all the methods you'll need, and register or unregister events directly as needed. Based on this discussion, I can only imagine that whatever language(s) you normally program in are very different than Lua...
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote