[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: Strange userdata metatable behavior in C API
- From: "Jerome Vuarand" <jerome.vuarand@...>
- Date: Mon, 4 Jun 2007 10:26:42 -0400
Peter Odding wrote:
> dormando wrote:
>> I do have one real question however; I have the 2nd ed PiL book, the
>> 5.1 ref man, and the online manual. All of which devote a single
>> sentence saying that lightuserdata does not have a metatable.
>> However, this appears to not be the case :P It has a single
>> metatable for all types (like numbers, strings, etc). So when I set
>> another metatable for the second lightuserdata object, it overwrote
>> it globally.
> So this is in fact documented, though I must admit I wasn't aware of
> it either.
Section 2.8 - Metatables  of the online manual starts with the
> Every value in Lua may have a metatable.
A few lines below you can also read:
> Tables and userdata have individual metatables (although multiple
> tables and userdata can share their metatables); values of all other
> types share one single metatable per type. So, there is one single
> metatable for all numbers, and for all strings, etc.
Maybe that would be clearer with "Tables and full userdata have