On 10/12/2010, at 4:07 PM, starwing wrote:
> Lua5.2 has a new _ENV mechanism, it's simpler than previous global mechanism. and we can write
> do
> local _ENV = ...
> -- codes
> end
>
> to set a septate env for code chunks.
>
> but at a most times, we need import standard functions into the new _ENV, e.g. print, pairs, etc. may we register all these std-function into a pre-defined table?
>
> may it named _PRIM or _BASE or _BUILTIN, and we can generate new env table easily.
>
> or we can put this table into stdlib library.
But wouldn't normal practice be to put any of those functions into locals?