[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: Petite Abeille <petite.abeille@...>
- Date: Thu, 10 Nov 2011 12:04:25 +0100
On Nov 10, 2011, at 11:48 AM, Miles Bader wrote:
>> 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.
Yeah, perhaps a one line utility function of your own would go a long way to keep you happy :))
assert( load( io.open( 'Test.lua', 'rb' ):lines(), 'Test', 't', _G ) )