1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2024-12-28 18:18:52 +00:00

Fix bug in lua_ui/content.lua: getmetatable(ui.content{}) shouldn't return a global mutable table

This commit is contained in:
Petr Mikheev 2023-02-14 09:43:24 +01:00
parent 65885d994f
commit eceeb15ee5
2 changed files with 2 additions and 2 deletions

View File

@ -42,7 +42,7 @@ namespace
mLuaState.sol()["M"] = makeContent(makeTable()).getMetatable();
std::string testScript = R"(
assert(not pcall(function() setmetatable(makeContent{}, {}) end), 'Metatable is not protected')
assert(getmetatable(makeContent{}) ~= M, 'Metatable is not protected')
assert(getmetatable(makeContent{}) == false, 'Metatable is not protected')
)";
EXPECT_NO_THROW(mLuaState.sol().safe_script(testScript));
}

View File

@ -135,6 +135,6 @@ M.__pairs = function(self)
return next, self, 1
end
M.__ipairs = M.__pairs
M.__metatable = {}
M.__metatable = false
return M