[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (work4) now available
- From: phlnc8 <phlnc8@...>
- Date: Sun, 1 Aug 2010 16:45:40 -0400
On Sun, Aug 1, 2010 at 4:36 PM, Jim Whitehead II <jnwhiteh@gmail.com> wrote:
> On 1 Aug 2010 20:31, "phlnc8" <phlnc8@gmail.com> wrote:
>>> Probably something like this:
>>>
>>> local _ENV={}
>>> function f1() ... end
>>> function f2() ... end
>>> ...
>>> return _ENV
>>>
>>
>> In that case, globals (builtins) cannot be used within definitions!?!
>> Did I miss something?
>
> If you want to use something from the outer environment, you can store it
> and use it. This is precisely the same as using module() without
> package.seeall in Lua 5.1.
>
Do you mean redefining as local all the builtins used in the module?
local table = table
local string = string
local print = print
. . .
. . .
local _ENV={}
. . .