[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Require problems in sandboxed thread
- From: "D Burgess" <dburgess@...>
- Date: Mon, 31 Jul 2006 22:51:48 +1000
I think this is one of the problems I was trying to articulate a couple
of weeks ago.
When you say you are creating an environment table I presume
that you mean that you are creating a function environment for
the thread (i.e. LUA_GLOBALSINDEX) and this environment is
metatabled to the main global environment.
The problem could be that the first time you call require it compiles
and the module and *sets the function environment to the environment
of the caller*. Which if the package is using seeall() metables back to
LUA_GLOBALSINDEX (your intial thread environment). This means
that the second time you call the require(d) functions there is a good
chance the function environment for the require(d) functions will not
be what you expect.
What is the simplest way to avoid this problem?
If you find a simple way around this let me know.