lua-users home
lua-l archive

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


Hi,

I have two questions:

1 ) Given following class declarations;

class A {
public:
    static const char className[];
    static const Luna<A>::RegType Register[];
    A(lua_State* L);
    virtual ~A();
public:
    const int set(lua_State* L);
    // etc
};

class B {
public:
    static const char className[];
    static const Luna<B>::RegType Register[];
    B(lua_State* L);
    virtual ~B();
public:
    const int getA(lua_State* L);
    // etc
};

what should I put in
const int B::getA(lua_State* L) {
   // ...
}

which expected to return a pointer to A ?

2) The library which I'm trying to implement lua binding uses a callback
mecanism.
ie.
in C++:

class C {
public:
void call(const A&)=0;
};

user is required to subclass C and implement call function.
Then this subclass is passed as parameter to some api function.

I want to implement same usage (by forwarding C++ callback & parameter to
lua) in lua.
Is it possible ?

Thanks,
---
Best regards,
Hakki Dogusan
dogusanh@tr.net
http://home.tr.net/dogusanh