I've never seen getmetatable
used anywhere. Is it useless? Can't you just return the setmetatable and cache it into a variable?
You could do something like this:
local tab = {} function tab.new() return setmetatable({}, tab) end local s = tab.new() -- here is your metatable