Fixed setmetatable(t, nil), closes #464.

This commit is contained in:
Florian Nücke 2014-08-04 23:55:23 +02:00
parent f685f81cc7
commit 18213bde2a

View File

@ -78,6 +78,9 @@ sandbox = {
rawset = rawset, rawset = rawset,
select = select, select = select,
setmetatable = function(t, mt) setmetatable = function(t, mt)
if type(mt) ~= "table" then
return setmetatable(t, mt)
end
local gc = rawget(mt, "__gc") local gc = rawget(mt, "__gc")
if type(gc) == "function" then if type(gc) == "function" then
-- For all user __gc functions we enforce a much tighter deadline. -- For all user __gc functions we enforce a much tighter deadline.