Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/164.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ Luabind和类实例_C++_Lua_Luabind - Fatal编程技术网

C++ Luabind和类实例

C++ Luabind和类实例,c++,lua,luabind,C++,Lua,Luabind,我正在开发一个数据驱动的游戏引擎,我正在寻求集成lua 我似乎在使用luabind将当前组件类的实例绑定到lua元表时遇到了问题 下面是有问题的代码: void BaseScriptComponent::createScriptObject() { LuaStateManager* pStateManager = LuaStateManager::get(); assert(pStateManager != nullptr); assert(luabind::type(m

我正在开发一个数据驱动的游戏引擎,我正在寻求集成lua

我似乎在使用luabind将当前组件类的实例绑定到lua元表时遇到了问题

下面是有问题的代码:

void BaseScriptComponent::createScriptObject()
{
    LuaStateManager* pStateManager = LuaStateManager::get();
    assert(pStateManager != nullptr);
    assert(luabind::type(m_scriptObject) != LUA_TNIL);

    // Get meta table
    luabind::object metaTableObject = pStateManager->getGlobalVars()[METATABLE_NAME];
    assert(luabind::type(metaTableObject) != LUA_TNIL);

    // Set __object to reference this class instance. 
    // Compilation failure due to this
    metaTableObject["__object"] = this;
    // Set meta table
    luabind::setmetatable(m_scriptObject, metaTableObject);
}
编译器错误为:

undefined reference to `bool luabind::get_back_reference<BaseScriptComponent*>(lua_State*, BaseScriptComponent* const&)' 
bool luabind::get_back_reference(lua_State*,BaseScriptComponent*const&)的未定义引用

非常感谢您的帮助。

您能出示您的模块/班级的注册码吗?另外,我认为您的代码在使用luabind注册对象时非常不寻常,或者至少我不完全确定您试图用这段代码实现什么。