Re: No-globals patch proposal. (Was: Re: Another take on locals by default)
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: No-globals patch proposal. (Was: Re: Another take on locals by default)
- From: Peng Zhicheng <pengzhicheng1986@...>
- Date: 2012年5月27日 11:33:23 +0800
于 2012年5月27日 1:22, Xavier Wang 写道:
Maybe you can do this by simply:
local _ENV
after this point, all global access are not allowed.
or the following idiom (looks a little cluttered though):
(function (_ENV)
-- your code here
....
end)(ACTUAL_ENV_TABLE)
you may change the actual environment easily by passing it as a parameter.
if Lua has some clearer lambda syntax, this would look better.