[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: 5.2 news
- From: Jonathan Castello <twisolar@...>
- Date: Thu, 18 Feb 2010 13:55:31 -0800
Nitpick: I would prefer loadfile(env, "config.lua"), to match the
parameter order of loadin(env, chunk). Otherwise I completely agree.
~Jonathan
On Thu, Feb 18, 2010 at 1:43 PM, Nick Gammon <nick@gammon.com.au> wrote:
>
> On 16/02/2010, at 12:12 PM, David Burgess wrote:
>
>> Any news on the 5.2 front?
>
>
> I haven't seen any comment on my message in an earlier thread, that the following code:
>
> local env = {}
> local f = assert (loadfile ("config.lua"))
> setfenv (f, env) ()
>
> ... which lets you load a configuration file into a table, will no longer work under Lua 5.2.
>
> Excepting that you use the io library (which you may not even want to include, or have reservations about allowing the use of, due to the ability to read/write to arbitrary files on the user's file system).
>
> My suggested fix was allowing the passing in of an environment into loadfile, eg.
>
> local env = {}
> local f = assert (loadfile ("config.lua", env)) ()
>
>
> - Nick