Originally Posted by Wandamey
I have no idea what you just said, I can only guess that I'll have to try to replace ZO_Smithing with the table Ayantir uses?
|
SMITHING, that's the instance ...
... of class ZO_Smithing, a subclass ...
... of class ZO_Smithing_Common, a subclass ...
... of ZO_Object
When SMITHING:OnSelectedPatternChanged() is called, Lua looks for "OnSelectedPatternChanged" key
first in the "self" table you called it on -> SMITHING
if it's not there, it looks in the class -> ZO_Smithing
if it's not there, it looks in the base -> ZO_Smithing_Common
and so on
You can put your hooks anywhere in the hierarchy -- sometimes that's necessary, for example when there are many objects of a class, that are created on the fly, and you want to change the behaviour of all of them, past and future -- you replace methods in the class. But hooks higher in the hierarchy overrule base class hooks (more precisely that's because of how ZO_PreHook works; you could write a hook that honors base class overrides, but nobody does that). For singleton objects that are hooked by various add-ons it's best to hook on the singleton, highest level, so that your hooks aren't overruled.