Re: setting _ENV in Lua 5.2 when loading a file...?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: setting _ENV in Lua 5.2 when loading a file...?
- From: Enrico Colombini <erix@...>
- Date: 2011年11月10日 14:38:15 +0100
On 10/11/2011 14.05, Roberto Ierusalimschy wrote:
The option 'env' in loadfile is trivial, but the option 'mode' is not.
The real question is how frequent people need to change the environment
of trusted code. (And how frequent people need to change the environment
in general.)
Well, in 5.1 I set the environment:
- to read a configuration file in its own table.
- to load user code in a 'light' sandbox with its own set of globals.
I also have less common situations, such us evaluating the same function
in multiple environments, but that does not concern loading (and Luiz
already explained how to do it).
--
Enrico
- References:
- setting _ENV in Lua 5.2 when loading a file...?, Miles Bader
- Re: setting _ENV in Lua 5.2 when loading a file...?, Petite Abeille
- Re: setting _ENV in Lua 5.2 when loading a file...?, Miles Bader
- Re: setting _ENV in Lua 5.2 when loading a file...?, Michal Kottman
- Re: setting _ENV in Lua 5.2 when loading a file...?, Miles Bader
- Re: setting _ENV in Lua 5.2 when loading a file...?, Roberto Ierusalimschy
- Re: setting _ENV in Lua 5.2 when loading a file...?, Matthew Frazier
- Re: setting _ENV in Lua 5.2 when loading a file...?, Roberto Ierusalimschy
- Re: setting _ENV in Lua 5.2 when loading a file...?, Patrick Rapin
- Re: setting _ENV in Lua 5.2 when loading a file...?, Roberto Ierusalimschy