lua-users home
lua-l archive

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

"Martin Dvorak" <> wrote:
> Let's say I have thousands of objects in my application
> and I would like to create individual environment (or state)
> for each object, so that objects cannot interfere between
> each other. I am afraid it might not effective to have so
> many environments. Or was the new version developed
> exactly with this point in mind (I mean that the authors
> assumed the new version to be used this way)?
> Also, I am trying to make up some kind of technique which
> would allow one environment to access some Lua variable
> in another environment. I've been thinking of a system of
> pointers managed from C. Also, it would require reference
> counting mechanism and special tags marking some
> variables as "foreign". Does anyone have a better solution?

If you put a hook on the globals table to prevent those objects
from accessing it, and don't give those objects any pointers to 
objects(tables) that you don't want them to have access to, they
should be effectively isolated even if they were all in the same
Lua state.