[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Checking for the same metatable
- From: Florian Weimer <fw@...>
- Date: Fri, 05 Dec 2008 19:25:56 +0100
* Jerome Vuarand:
> 2008/10/19 Florian Weimer <email@example.com>:
>> 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.