local getmetatable, setmetatable = getmetatable, setmetatable
local dgetmt = debug.getmetatable
+local newproxy = newproxy
+
+if not newproxy then
+ -- tables can have __gc from 5.2
+ newproxy = function(b)
+ if b then
+ return setmetatable({}, {})
+ end
+ return {}
+ end
+end
-- multiple inheritance index with depth-first search
local proto_lookup = function(protos, name)
end
}
-local newproxy = newproxy
-
local robj_gc = function(px)
local dtor = px.__dtor
if dtor then dtor(px) end
M.Readonly_Object = M.Object:clone {}
M.Readonly_Object.__call = function(self, ...)
local r = newproxy(true)
- local rmt = getmetatable(r)
+ local rmt = dgetmt(r)
rmt.__index = self
rmt.__tostring = Object_MT.__tostring
rmt.__metatable = false