I am using luabind and I want to make this lua code work.
print("hello..welcome to lua\n")
base:PrintMe("printing from base" )
From c++, I want to assign the lua global variable "base" as a pointer to "Base" class.
class Base {
public:
void PrintMe(const char *s) { ... }
};
Using Luabind I can bind the Base class. I am creating a Base class object in c++. I want to push this pointer to lua and use it as lua global variable "base" as seen in the lua code above.
Can someone please help me, the most easiest way to do this (using luabind itself if possible) ?? I have tried pushing it as a lightuserdata, but the PrintMe is not getting called from lua.
This line will take care of the issue :)
globals(ls) ["base"] = baseObjPtr;