a = (a or 0) + 1 t = setmetatable(t or {}, {__gc = function() print(a) end})