[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.1 / 5.2 threads
- From: Peter Cawley <lua@...>
- Date: Wed, 27 Apr 2011 15:57:33 +0100
On Wed, Apr 27, 2011 at 3:53 PM, Anthony Howe <achowe+lua@snert.com> wrote:
> In Lua 5.1 a thread has an environment and section 2.8 starts with
> "Every value in Lua can have a metatable." So a thread can also have a
> metatable in addition to an environment?
If you continue reading 2.8, then you find the following:
"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."
So every thread can have a metatable, but the granularity for setting
metatables on threads is such that if one thread has a metatable, then
all threads have that metatable. As far as I'm aware, this hasn't
changed between 5.1 and 5.2.