lua-users home
lua-l archive

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


we try to use Lua in a system which has a lot of threads
created/destroyed dynamically. We use Lua in those threads to control
our software.
That means we do a lua_open() in the thread at some point after it has
been created, set up some tables and registry values, do our lua_pcall()
to hand over control to the script (which itself calls functions written
in C) and then we close Lua and the thread is destroyed at some point.

The problem is, lua_open creates a new environment which is nice in some
respect (no resetting of old data needs to be done) but on the other
hand I need to reload all the data which could be "persistent" (like
database connection parameters..).

I thought of starting one Lua up in the main thread and set up global
variables in that environment. I just can't see how I can access the
global variables of one lua environment from another lua environment on
the scripting level (hopefully without going through the registry).

Is that possible at all or am I just not seeing the obvious??