lua-users home
lua-l archive

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


> Any special requests?  - besides Australia beating Brazil at the football:).

Well, I cannot do anything about that, either way, mate.

> I need multiple 'environments' running in a single lua_state and need them to be protected from each other and to be invisible to each other.

Just use different Lua states.

> but then all my library code needs to be loaded in each one

What's so bad about that?

> I appreciate the way multiple environments can be used to contain code/data and 'hide' it from other environments while pointing to a shared global environment, but it seems to me that a programmer could still find his way around into places he shouldn't be using raw_get/set.

Not if you set new global tables for the child states and make those
global tables inherit from the main state. Setting a __metatable field
in the metatable of the child state global table should protect the
parent global table for any access from Lua.

--lhf