lua-users home
lua-l archive

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