[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Thread woes
- From: Mark Hamburg <mhamburg@...>
- Date: Thu, 16 Oct 2003 16:25:00 -0700
on 10/9/03 4:22 PM, Joel Pritchett at email@example.com wrote:
> Ok, the __index thing is really neat and works well
Sorry for the late posting.
One thing I discovered when doing this is that pairs does a rawget on the
globals to get the "next" function which isn't a great thing to do if you've
changed the global environment.
In this case, I was changing the value of LUA_GLOBALSINDEX by calling
lua_replace( L, LUA_GLOBALSINDEX ) and the thread in question was being used
as a sandbox for an editing/execution environment. Could I avoid these
problems simply by setting the sandbox as the environment for the result of
compiling each chunk of code? Or should I stick with the approach of copying
into the sandbox the values that cause problems?