Can class.inherit be redone via superloading?

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
aardvark
Wyrmic
Posts: 200
Joined: Wed Aug 22, 2012 12:16 am

Can class.inherit be redone via superloading?

#1 Post 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?

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Can class.inherit be redone via superloading?

#2 Post 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
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

aardvark
Wyrmic
Posts: 200
Joined: Wed Aug 22, 2012 12:16 am

Re: Can class.inherit be redone via superloading?

#3 Post by aardvark »

Good enough. I thought it was doing something tricky with metatables. A closer look reveals otherwise. Thanks for the quick response.

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Can class.inherit be redone via superloading?

#4 Post by darkgod »

Yeah most methods are directly cached to speed up method lookup
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Post Reply