lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

* Jerome Vuarand:

> 2008/10/19 Florian Weimer <>:
>> Is it possible to check if two table have the same metatable, or if a
>> table has a specific table as its metatable, besides using
>> debug.metatable?  This should work even if __metatable has been
>> overridden, and I think it would be fairly safe.
> It's not possible in pure Lua, that's the whole point of __metatable
> metamethod to lock the object from potentially malicious Lua code.

But checking if two tables have same metatable does not give me access
to the metatable.  Furthermore, the information leaks if you perform
one of the ordered comparison operators anyway.

And I've already got a copy of the metatable, checking to see if an
object shares it should be safe, too.