Page 1 of 1

Can class.inherit be redone via superloading?

Posted: Tue Jan 08, 2013 12:21 am
by aardvark
I'm working on updating my Telepathy Enhancement addon for v1.0 and changing it to a ToME-style interface for mod.class.Actor in the process. This means Actor needs to inherit the new class. Can I re-call the function returned by class.inherit() with my new interface class appended to the old base class list? Or must I overload Actor.lua to make the change?

Re: Can class.inherit be redone via superloading?

Posted: Tue Jan 08, 2013 12:41 am
by darkgod
You must *superload* Actor, not overload it.
In the next version you will be able to call "_M:importInterface" to do exactly what you wish; but for now just place your functions inside Actor directly.
This is what importing the interface does anyway

Re: Can class.inherit be redone via superloading?

Posted: Tue Jan 08, 2013 2:36 am
by aardvark
Good enough. I thought it was doing something tricky with metatables. A closer look reveals otherwise. Thanks for the quick response.

Re: Can class.inherit be redone via superloading?

Posted: Tue Jan 08, 2013 9:20 am
by darkgod
Yeah most methods are directly cached to speed up method lookup