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

pull/3229/head
Petr Mikheev 2 years ago
parent 65885d994f
commit eceeb15ee5

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

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

Loading…
Cancel
Save