Module:log set and get

-- unique keys local inner_key = function end local name_key = function end

local function write_key(self, k) return (rawget(self, name_key) or "") .. "[" .. tostring(k) .. "]" end

local mt = { __newindex = function(self, k, v) mw.logObject(v, "setting " .. write_key(self, k)) rawset(rawget(self, inner_key), k, v)	end, __index = function(self, k)		local v = rawget(rawget(self, inner_key), k) mw.logObject(v, "getting " .. write_key(self, k)) return v	end, __pairs = function(self) return pairs(self[inner_key]) end, __ipairs = function(self) return ipairs(self[inner_key]) end, }

return function(t, name) return setmetatable({ [inner_key] = t, [name_key] = name }, mt) end