Get getmetatable
to return nil
by a function I've assigned a __metatable
field to.
Code:
local tbl, mt = {}, { __metatable = function() return nil; end }; setmetatable(tbl, mt); print(getmetatable(tbl));
The call getmetatable(tbl)
is literally evaluating to the function itself and not calling it,
Is there a way to get this to happen, or would I just have to use some other value? Like an arbitrary table, boolean, ect?? I'd really prefer nil
being the output, but if not then oh well.
{__metatable = nil}
is NOT going to work since the index won't even be added. Just a note for the inexperienced.