[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: Patrick Rapin <toupie300@...>
- Date: Thu, 10 Nov 2011 13:28:40 +0100
>> why can't it be `loadfile([filename[, env]])` or `loadfile([filename[, mode[, env]]])`?
> It certainly can. The point is whether it should ;) It increases both
> the implementation and the manual (but by minimal amounts).
IMHO, it should, unless:
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.
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