lua-users home
lua-l archive

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


Wim Couwenberg wrote:
trust.no.one wrote:

Can I set for example __index of the methodtable whit the methodtable
of
the father?


Not quite.  You should set the __index of the _metatable_ of the
methodtable.  (Otherwise __index will be treated as an ordinary field.)  But
maybe this is what you meant above?


Here is an improved version of Luna for Lua 5.0 that gives a metatable to the method table. Also the method table is put in the table of globals to make it easy to access from scripts. The __call metamethod is set to the 'new' method so that your scripts can still call the constructor as Account(100). This is the same as Account:new(100).

Note the new version is called Lunar.h and it should be compatible with Luna.h

http://lua-users.org/wiki/CppBindingWithLunar

- Peter Shook