   Bind specific object to lua/luabind
  Hi!!Please, I need to bind an specific object to a lua entry. I need to do something like this:I know I can achieve something similar binding a C++ class using luabind and defining a function that returns an object:class CGameObject{...};CGameObject g_gameobject;CGameObject* GetGameObject( ){return &g_gameobject; }int main(...){    ...    module(lLuaState)    [   def("GetGameObject", &GetGameObject),    class_<CGameObject>("GameObject")    ];}In our game every gameobject has its own lua_State. The problem is that a static function like GetGameObject() does not know which object to pass as an argument.Is there a way to do something like the following?class CGameObject{public:  void Init()  {    ...    lua_pushstring( mLuaState, "self" );    lua_push...( mLuaState, this );    lua_settable( mLuaState, LUA_GLOBALSINDEX );  }private:   lua_State* mLuaState;};Thanks!!!   
  If I understand the question properly, I did this just yesterday and the answer I came up with is to use a closure.lua_pushlightuserdata(L,this);lua_pushcclosure(L,func,1);lua_setglobal(L, name);Then inside the function, you can ask; OWNER* owner = (OWNER*)lua_touserdata(L,lua_upvalueindex(1));And then owner holds the "this" pointer from the function creation.It's not quite automagic, but it worked for what I needed it for.   