   calling a C++ method bound from Lua with Luabind
  Hi All,I have been trying to integrate Lua into a project for the first time, using Luabind. I have a quake-style console, to which I would like to redirect Lua's print output to. the initialization code is as follows:module(L)[class_<cConsole>("Console").def("print", &cConsole::Print).def("get" ,&cConsole::Get)]m_SubSystems->AddSubsystem(100, GFX()); // init GFX by calling macro GFX(),// which creates GFX and inits it if// it does not exist already, and //returns a pointer to the GFX class.cConsole* conptr = GFX()->m_pConsole;luabind::globals(L)["con"] = &conptr   // assert fails hereluaL_dostring(L, "print = function(s) con:print(s) end");The code compiles, but when I execute I get a failed assertion:Assertion Failed, luabind.../policy.hpp Line 487Expression: crep && "you are trying to use an unregistered type"Where am I going wrong? This seems such a simple task but I feel like I have been banging my head against a brick wall! :)   
  You're passing a pointer to a pointer to your console in these lines:cConsole* conptr = GFX()->m_pConsole;luabind::globals(L)["con"] = &conptr;   // assert fails hereTrycConsole &console = *GFX()->m_pConsole;luabind::globals(L)["con"] = console;Haven't checked it out actually compiling something, but maybe one level of indirection (Console *) is okay.If the problem persists, just report back, I'll be around ;)   ;  Hi Cygon,Thanks very much for the help. The code you posted has certainly helped me out. The program now compiles and executes. However, whilst shutting down, when I execute lua_close(L), the GC tries to delete the Console object, causing problems, as it has already been deleted elsewhere. (At least I know that the binding is working now!:) )Also, my efforts to redirect Lua's print() function have failed - the lineluaL_dostring(L, "print = function(s) con:print(s) end") executes without returning an error, but calls to print() from Lua in my main game loop do not get passed to the console. I tried calling con:print('test') instead, but this results in LuaL_dostring returning 0, so something is not working properly there.   