lua-users home
lua-l archive

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


Can you write some Lua code as an example of what you're trying to achieve? I don't understand. My best guess at what you mean leads me to:

If the subclass is a type in c++ then calling base class methods is no different than calling class methods, just wrap the subclass with a suitable metatable.

If the subclass isn't a type in c++ then provide a metatable for the class, and store the base class as field in the subclass table. Then write an __index method which for your subclass which calls the appropriate method on the appropriate self (base userdata or subclass table)

Thanks.
Kev

Sent from my iPhone

On 24 Feb 2013, at 13:20, TheGreat Guru <nikosbatsaras@gmail.com> wrote:

> Hello all :) Just wondering if the is a way to bind c++ classes to lua
> BUT with c++ inheritance support !
> I mean if the is a way to write lua scripts and create objects of a
> c++ subClass that can access the methods of baseClass.
> What i am looking for is some link for a good tutorial OR some custom
> code sample/s !
> 
> *IMPORTANT : I dont want to use a library like luaBind , toLua ,
> LuaCpp or even SWIG . Just simple lua C API .
> 
> Thanks all !
>