lua-users home
lua-l archive

[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]]])`?

It certainly can. The point is whether it should ;) It increases both
the implementation and the manual (but by minimal amounts).

The change also breaks some code, like this one:

  loadfile(string.gsub(filename, '%.', '/'))

The result is a quite confusing error when running the chunk:

  temp:1: attempt to index upvalue '_ENV' (a number value)

-- Roberto