Original Post
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 here
luaL_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 487 Expression: 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! :)