lua-users home
lua-l archive

Re: setting _ENV in Lua 5.2 when loading a file...?

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


On Nov 10, 2011, at 6:31 , Roberto Ierusalimschy wrote:
> return load(io.lines(filename, 2^12), filename, 't', env)
> 
> seems reasonable.
> 
> -- Roberto
It took me a minute to realize what `io.lines(filename, 2^12)` meant. loadfile's signature is currently just `loadfile([filename])`, why can't it be `loadfile([filename[, env]])` or `loadfile([filename[, mode[, env]]])`?
Thanks,
Matthew Frazier
http://leafstorm.us/

AltStyle によって変換されたページ (->オリジナル) /