lua-users home
lua-l archive

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


On 19/02/2010, at 8:36 PM, steve donovan wrote:

> On Thu, Feb 18, 2010 at 11:48 PM, Geoff Leyland
> <geoff_leyland@fastmail.fm> wrote:
>>> 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.
>> 
>> I do exactly this too.  It'd be a shame if 5.2 broke it.
> 
> Do remember that loadin can also be passed a code string (like
> loadstring) but then I guess you still have to have io.read().

Oh, right, well that's ok then.  Thanks!

> Although surely this is not the kind of thing you would do in a sandbox?

Sandbox?  Maybe I'm naive in thinking that most of the work I do is unlikely to suffer security issues, but in that particular case, if you can change the the config file, you can just go and change the script that's reading it.

Cheers,
Geoff