[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: metatables and things other than userdata
- From: "Murray S. Kucherawy" <msk@...>
- Date: Thu, 25 Aug 2011 13:59:13 -0700
> -----Original Message-----
> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org]
> On Behalf Of Patrick Rapin
> Sent: Thursday, August 25, 2011 1:06 PM
> To: Lua mailing list
> Subject: Re: metatables and things other than userdata
>
> > In fact I find that it only works if a full userdata is tagged with a
> > metatable. But that's not what the docs say.
>
> The documentation in fact explicitly states that only full userdata
> and tables can have their own metatable.
> The following citation comes from chapter 2.8 of the reference manual
> [1]
>
> "Tables and full userdata have individual metatables (although
> multiple tables and userdata can share their metatables). Values of
> all other types share one single metatable per type; that is, there is
> one single metatable for all numbers, one for all strings, etc. "
>
> [1] http://www.lua.org/manual/5.1/manual.html#2.8
Ah, thanks. I was relying on the documentation in the individual functions as complete, and the documentation for lua_setmetatable() simply says:
"Pops a table from the stack and sets it as the new metatable for the value at the given acceptable index."
-MSK