lua-users home
lua-l archive

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


> In version 3.1, there is a brief mention of "multiple interpretation
> environments" on the FAQ.  That sounds great!

The support is a very simple one: *All* global variables have been put in a
dynamic structure, so now Lua has only one (1) global variable, which is a
pointer to that structure. You can create many of these structures, and each
one will be a *completely independent* environment. To switch environments,
one only has to switch the value of this global pointer.

> Will there be support for multiple threads running different Lua environments?
Not directly. For real multy-thread you need a way to switch the global
pointer when there is a context-switch. In some systems this may be easy,
in ohters not...

>  Will there be multiple garbage collectors, or just one Lua memory space?
The environemnts will be *completely independent*. Each one has it global
space, memory space, garbage collector structures, etc.

> Is there any way to communicate between different environments?
No, but it can be done via a C library; but it will have the same problems
that comunicating between processes (e.g. how to pass functions).

  The main rationale has been: it is very difficult to make everybody happy,
mostly in a portable way. This solution is very simple, has an almost null
cost, and even not solving some problems it facilitates for each one to
solve individual problems.

-- Roberto