lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Thu, Feb 14, 2008 at 7:34 PM, Taj Khattra <> wrote:
>  not sure i understand your concern, but see
>  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:
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.