lua-users home
lua-l archive

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


> On Jun 25, 2015, at 10:17 AM, Soni L. <fakedme@gmail.com> wrote:
> 
> 
> 
> On 25/06/15 02:16 AM, Tim Hill wrote:
>>> On Jun 24, 2015, at 10:56 AM, Soni L. <fakedme@gmail.com> wrote:
>>> 
>>> You can't get enclosing closures.
>>> 
>>> function f()
>>>  -- _ENV = _ENV -- redundant because we're making g a global, so we need _ENV
>>>  function g() (""):doSomething() end -- function has no _ENV
>>> end
>>> -- good luck getting the env of g :P
>>> 
>>> -- 
>>> Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY.
>>> 
>> function g() (""):doSomething(_ENV) end
>> 
>> —Tim
>> 
>> 
> And how does that help with SANDBOXING the string metatable?
> 
> I mean, you'd be running untrusted code…
> 
It doesn’t and it wasn’t intended to. If you need to sandbox Lua functions you need a different approach.

—Tim