lua-users home
lua-l archive

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


On 10 November 2011 11:48, Miles Bader <miles@gnu.org> wrote:
> Petite Abeille <petite.abeille@gmail.com> writes:
>> It takes an environment in 5.2:
>>
>> load (ld [, source [, mode [, env]]])
>
> Yeah, but as I mentioned, "load" is kind of annoying to use; having
> "loadfile" take an (optional) environment parameter would be much
> nicer.

I could not find the message on this list, but I remember an
'io.lines' trick to do the job with load:

function myloadfile(filename, env)
  return load(io.lines(filename, '*L'), filename, 't', env)
end