[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: Peter Cawley <lua@...>
- Date: Thu, 10 Nov 2011 11:54:29 +0000
On Thu, Nov 10, 2011 at 11:31 AM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> > function myloadfile(filename, env)
>> > return load(io.lines(filename, '*L'), filename, 't', env)
>> > end
>>
>> Hmm, I expect that's not very efficient for extremely large files
>> though... (even read"*a" is horrible for extremely large files!)
>
> return load(io.lines(filename, 2^12), filename, 't', env)
>
> seems reasonable.
>
> -- Roberto
>
>
Except that you probably want '@'.. filename, and you may also want
the first line skipped if it begins with a "#".