|
Hi,
Your example suffers from the same issue. Take the following code: t = get_secure_table() mt = getmetatable(t) oldindex = mt.__index mt.__index = function(t, k) log_key(k) end setmetatable(t, mt)
If the object's metatable has a "__metatable" field, getmetatable() returns the associated value. Can't you use this trick to protect the datastructure? setmetatable() will also honor __metatable by raising an error. []s, Diego