[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Userdata with no environment table by default
- From: Chris <coderight@...>
- Date: Thu, 14 Feb 2008 20:01:36 -0500
On Thu, Feb 14, 2008 at 7:34 PM, Taj Khattra <taj.khattra@gmail.com> wrote:
> not sure i understand your concern, but see
> http://lua-users.org/lists/lua-l/2005-04/msg00213.html
> for an example usage of userdata environments.
>
As far as I know, I know how to use environment tables. That isn't
the problem. See here: http://lua-users.org/wiki/UserDataRefinement
for more discussion about what my issue is (although this is also
talking about metatables and I don't care about that in my situation).
Basically the problem is because a userdata always has an environment
it's difficult to know if it has its own environment or if it just
picked up the default environment. This makes it hard to know if you
can put data in the existing environment of if you need to create a
new table to be used as the environment for that specific userdata
(ie. "optional environment" on your userdata).
Of course you could always create a new environment for every userdata
but this is extremely memory inefficient when only a few of the
objects actually need an environment.
CR