Hi,
I have this function signature I have to match
typedef int (*lua_CFunction) (lua_State *L);//target sig
Here's what I have so far:
//somewhere else...
...
registerFunction<LuaEngine>("testFunc", &LuaEngine::testFunc, this);
...
//0 arg callback
void funcCallback0(boost::function<void ()> func, lua_State *state)
{
func();
}
template<typename SelfType>
void registerFunction(const std::string &funcName, boost::function<void (SelfType*)> func, SelfType *self)
{
//funcToCall has to match lua_CFunction
boost::function<void (lua_State *)> funcToCall = boost::bind(&LuaEngine::funcCallback0, this,
boost::bind(func, self), _1);
lua_register(_luaState, funcName.c_str(), funcToCall);
}
However, at lua_register(_luaState...
, it's still complaining about conversion issues
Error 1 error C2664: 'lua_pushcclosure' : cannot convert parameter 2 from 'boost::function' to 'lua_CFunction'
Anyone know how this can be solved?