我正在研究数据驱动的游戏引擎,而我正在寻求整合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&)'
感谢任何帮助。