lua-users home
lua-l archive

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]


于 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.

AltStyle によって変換されたページ (->オリジナル) /