diff --git a/apps/components_tests/lua/testlua.cpp b/apps/components_tests/lua/testlua.cpp index 5f1e11c435..940fa9b9c5 100644 --- a/apps/components_tests/lua/testlua.cpp +++ b/apps/components_tests/lua/testlua.cpp @@ -258,7 +258,7 @@ return { TEST_F(LuaStateTest, SafeIndexMetamethod) { const VFS::Path::Normalized path("metaIndexError.lua"); - sol::table t = mLua.runInNewSandbox(path); + sol::lua_table t = mLua.runInNewSandbox(path); // without safe get we crash here EXPECT_ERROR(LuaUtil::safeGet(t, "any key"), "meta index error"); } diff --git a/components/lua/luastate.hpp b/components/lua/luastate.hpp index 1a432ec749..4ec8a10320 100644 --- a/components/lua/luastate.hpp +++ b/components/lua/luastate.hpp @@ -286,7 +286,7 @@ namespace LuaUtil // work around for a (likely) sol3 bug // when the index meta method throws, simply calling table.get crashes instead of re-throwing the error template - sol::object safeGet(const sol::table& table, const Key& key) + sol::object safeGet(const sol::lua_table& table, const Key& key) { auto index = table.traverse_raw_get>( sol::metatable_key, sol::meta_function::index); @@ -306,9 +306,9 @@ namespace LuaUtil template sol::object getFieldOrNil(const sol::object& table, std::string_view first, const Str&... str) { - if (!table.is()) + if (!table.is()) return sol::nil; - sol::object value = safeGet(table.as(), first); + sol::object value = safeGet(table.as(), first); if constexpr (sizeof...(str) == 0) return value; else