How to do casting lua ?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to do casting lua ?

Supratik Champati
How do I achieve the equivalent of the infamous casting pointers ?

suppose I have

class A
{
    A();
    virtual ~A();
};
class B : public A
{
    B();
    void only_defined_in_B();
};
static A* seed() { return new B; }


If I do the following in lua

lseed = seed()
lseed:only_defined_in_B()    -- causes error


Now I know that lseed is a class B object  - but I cannot
access only_defined_in_B() routines of object lseed.

Is there a way by which I can acomplish the above even if that
involves violating every coding ethic.

Any help would be greatly appreciated.

Thanx.

--Supratik