Assigning the "this" pointer
Ben Ashley <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
Hi All,
Newbie Luabind user here! I've been having great success implementing
luabind in to my project, but have come across a snag.
I have the following code:
void LogManager::luaBindImpl() const
{
using namespace luabind;
lua_State* state(Supervisor::get<LuaManager>()->state());
// LogManager
module(state)
[
class_<LogManager>("LogManager")
.enum_("constants")
[
value("Info", 1)
,value("Warning", 2)
,value("Critical", 3)
,value("Debug", 4)
]
.def("log", &LogManager::log)
.def("registerSource", &LogManager::registerSource)
];
// Add to globals
globals(state)["LM"] = this;
}; // eo luaBindImpl
The problem is the line which sets the global "LM" to "this". Whenever I
call a function in my LUA script on "LM", I get the following error
(reported in my log file):
00:00:01:0060- lua:Exception - No matching overload found, candidates:
void registerSource(LogManager&,std::string const&)
The lua code is this:
LM:registerSource("test");
Interestingly, when I do:
globals(state)["LM"] = new LogManager();
... everything works as intended.
Am I doing something obviously wrong?
Many thanks in advance!
------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery,
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now.
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user