[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: lua_open and access to global variables
- From: Bernd Kronmueller <bernd.kronmueller@...>
- Date: Wed, 13 Apr 2005 11:09:07 +0100
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
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??