lua-users home
lua-l archive

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


Tim Niemueller wrote:
> Anders Backman schrieb:
>> Hi all.
>>
>> This is probably a wildly discussed topic, but I haven't found a good
>> compilation of the resources as new ones pops up all over the place, and
>> others die..
>>
>> Problem: Given a C++ API I want to export classes, methods, namespaces,
>> enums to lua. Being able to implement virtual methods in lua, calling
>> them from C++/lua transparently...
> 
> A critical point for us was the ability to have nested classes:
> 
> class A
> {
>  public:
>   class B
>   {
>     public:
>       void do_something();
>   };
> 
>   void useB(B* b);
> };
> 
> tolua++ does that just fine for us. I know that swig can't do it, but
> can others like LuaBind do this?

Yes, it can:

 module(L) [
     class_<A>("A")
       .scope [
           class_<A::B>("B")
       ]
 ];

-- 
Daniel Wallin
BoostPro Computing
http://www.boostpro.com