3

I'm working on a data driven game engine and I'm seeking to integrate lua.

I seem to be having an issue binding instances of the current component class to a lua meta-table using luabind.

Here's the problematic code:

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);
}

The compiler error is:

undefined reference to `bool luabind::get_back_reference<BaseScriptComponent*>(lua_State*, BaseScriptComponent* const&)' 

Any help is appreciated.

Antonis Kalou
  • 354
  • 5
  • 7
  • Could you show the register code of your module/class? Also I think that your code is very unusual to register objects with luabind, or at least I'm not totally sure what you're trying to accomplish with this code. – Cosmo Jun 25 '14 at 17:21

0 Answers0