Reputation: 211
Is there a way to get a tables metatable? e.g.
local tbl = {}
setmetatable(tbl, {__call = function() print("tbl called") end})
-- how to get metatable of tbl?
Upvotes: 2
Views: 986
Reputation: 26794
You can use getmetatable(tbl)
to get the assigned metatable (or nil
if none is assigned).
Upvotes: 4