_G.UIFather = {} function UIFather:New(prefab) local t = { ["prefab"] = prefab } setmetatable(t, self) self.__index = self return t end function UIFather:RegisterCloseEvent(instance, func, ...) function UIFather:OnEvent(event,param) end end function UIFather:OnEnable(instance) end function UIFather:OnDisable(instance) end _G.A = _G.UIFather:New() print("Before the mother function is called" ,A["OnEnable"], A["OnEvent"],UIFather["OnEvent"]) UIFather:RegisterCloseEvent() print("After the mother function is called" ,A["OnEnable"], A["OnEvent"],UIFather["OnEvent"])
The result of the call is:
Before parent function call function: 0054CDF0 nil nil After parent function call function: 0054CDF0 function: 0054CE70 function: 0054CE70 [Finished in 0.1s]