Making "self" Apply to More Than Two Classes

Secretive Loon <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
I want my Lua class to be able to inherit from two different classes just so
it can use the "self" keyword to access the second class's functions. I
found that "self" only works for the first class from which the class
inherits. Example:

*class *'BaseClass1'
*function *BaseClass1:B1Print()
*print*( 'in B1 print' )
*end*

*class *'BaseClass2'
*function *BaseClass2:B2Print()
*print*( 'in B2 print' )
*end*

*class *'DerivedClass1' ( BaseClass1, BaseClass2 )
*function *DerivedClass1:__init()
BaseClass1.__init( self )
BaseClass2.__init( self )
 self:B1Print() -- works fine
self:B2Print() -- nil. 'self' can't be used to access this classes functions
 BaseClass1.B1Print( self ) -- works fine
BaseClass2.B2Print( self ) -- works fine
*end*
*
*
Is there another way around this? LuaBind docs didn't say it couldn't do
this. If it can't be done using just the luabind 'class' method, is there
another way like by appending the index table of BaseClass2 onto the index
table for DerivedClass1? If that's possible, how might I go about doing it?

Thanks.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.