lua-users home
lua-l archive

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

2010/1/8 Alexander Gladysh <>:
> On Thu, Jan 7, 2010 at 20:56, Leo Razoumov <> wrote:
>> On 2010-01-07, Roberto Ierusalimschy <> wrote:
>>> Actually, getfenv and setfenv will be deprecated too. (But is is easy
>>>  to have them back for compatibility.)
>>>  Lua 5.2 will have "lexical environments", a kind of lexical setfenv.
>>>  The construction "in t do command end"  will execute <command> with
>>>  all global variables being resolved in <t>.
>> What would be Lua-5.2 idioms for creating sandboxes and jails?
> I'm concerned by the sandboxing issue as well.
> However, in 5.1 proper sandbox already requires using debug library
> (debug.sethook). Since Roberto said that "official" setfenv and
> getfenv would move to debug library and stay there, I guess we're
> fine.
> It is a pity though that trusted config file loading would have to use
> debug library now... I understand that load{file/string} would not be
> affected by "in" construction. Am I right?

Me too, I want to add my two cents: I've discovered the
getfenv/setfenv lately and I regret because it was *very* useful for
my code to use it with userdata. I've also rewritten yesterday a
sensible part of my code to use setfenv on userdata and everything is
more clean now.

For me it is not clear how the 'in' sintax will be reflected in term of C API.