lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi
Another newbie to this list...

I've been working with a few of the wiki examples using Lua5 and lunar.h -- http://lua-users.org/wiki/CallingLuaFromCpp What I want to know is the best way to access super/parent class methods of a C++ object.

I used the 'Account' example and gave it a parent class called 'Super' with methods 'incNum' and 'decNum'.

Lunar<Super>::RegType Super::methods[] = {
  method(Super, incNum),
  method(Super, decNum),
  {0,0}
};

This declaration alone was not enough to do it.. so I added the methods to the block below.

Lunar<Account>::RegType Account::methods[] = {
  method(Account, deposit),
  method(Account, withdraw),
  method(Account, balance),

  method(Account, incNum),
  method(Account, decNum),

  {0,0}
};

This works okay, but I have a program with multiple inheritance. Is there an easy way to include the methods of the parent classes? or is manually extending the list of methods for each inherited class preferred.

Thanks,


Scott DC
beuja@iinet.net.au
----------------------------------------------------------------------------
http://members.iinet.net.au/~beuja/crisis/
----------------------------------------------------------------------------