[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua_open and access to global variables
- From: Thamer Al-Harbash <tmh@...>
- Date: Wed, 13 Apr 2005 07:57:55 -0700 (PDT)
On Wed, 13 Apr 2005, Bernd Kronmueller wrote:
> 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).
You could write some accessors/setters for the "global"
environment in C and then bind them to lua so that the code can
be called by the different threads when they're running in lua
mode. Just make sure the C code is re-entrant and that you
synchronize access to the meta global environment.
> Is that possible at all or am I just not seeing the obvious??
It's very possible but lua in itself, as far as I can tell, does
not facilitate this transparently in anyway. You need to do it
GPG Key fingerprint: D7F3 1E3B F329 8DD5 FAE3 03B1 A663 E359 D686 AA1F