lua-users home
lua-l archive

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


on 10/9/03 4:22 PM, Joel Pritchett at jpritchett@sammystudios.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?

Mark