[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: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 10 Nov 2011 11:05:58 -0200
> 2) The load() function is extended a little more, to accept
> "@filename" as its first 'ld' parameter.
> So we could remove loadfile in addition to loadstring
We have considered this idea. One problem is that it demands a change in
luaL_loadfile (to check the mode) and an extra parameter (and therefore
a new name to avoid incompatibilities). A second problem is that
we lose the option to load the standard input.
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.)
> 1) The "#!/usr/bin/lua" initial line is ignored by the parser instead
> of the lua_loadfile function.
> BTW, I have already tried by accident to pass a chunk with such a
> line to lua_loadstring.
Did you have to change the environment of that chunk? :)
So, again, the question is: is it worth all those changes?
-- Roberto