lua-users home
lua-l archive

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


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