LuaBridge getGlobal kann nicht ausgeführt werden.



  • Hallo,
    Ich probiere, Attribute einer Entity aus einem Lua-Script auszuwerten.
    Bei der Funktion

    luabridge::getGlobal
    

    kommt der Fehler:

    error: cannot convert ‘lua_State*’ to ‘luabridge::lua_State*’ for argument ‘1’ to ‘luabridge::LuaRef luabridge::getGlobal(luabridge::lua_State*, const char*)’
    

    Allerdings bin ich verwirrt, weil die Funktion doch gar kein luabrigde::lua_State braucht bzw. es ihn gar nicht gibt, sondern nur einen "normalen" lua_State.

    EntityHelperFunction.h

    //include ...
    
    struct lua_State;
    
    namespace entityh{
        template <typename T>
        void addComponent(entityx::EntityManager& es, const entityx::Entity::Id& id, luabridge::LuaRef& componentTable);
        entityx::Entity::Id loadEntity(lua_State* L, entityx::EntityManager& es, const std::string& type);
    }
    

    Ausschnitt aus meiner Funktion

    entityx::Entity::Id entityh::loadEntity(lua_State* L, entityx::EntityManager& es, const std::string& type){
        using namespace luabridge;
        entityx::Entity e = es.create();
        auto v = luah::getTableKeys(L, type);
        LuaRef entityTable = getGlobal(L, type.c_str());
        for (auto& componentName : v) {
        // ....
    

    Vielen Dank für das Lesen
    Viele Grüße


Anmelden zum Antworten