私はこの関数の署名を持っています私は一致しなければなりません
typedef int (*lua_CFunction) (lua_State *L);//target sig
これが私がこれまでに持っているものです:
//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);
}
ただし、ではlua_register(_luaState...
、まだ変換の問題について不平を言っています
エラー1エラーC2664:'lua_pushcclosure':パラメーター2を'boost::function'から'lua_CFunction'に変換できません
誰もがこれを解決する方法を知っていますか?