if getMetatable(some_table) ~= nil then print "It has a Metatable" else print "It doesn't have a Metatable" end
即使通过设置__Metatable = false来“隐藏”,它也会检测到Metatable.如果你想要尊重这一点并考虑一个“隐藏”的元表根本就没有Metatable,你还必须检查false(或者只是写一下getMetatable(some_table)然后……)
(感谢Egor Skriptunoff指出这一点!)