lua-users home
lua-l archive

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


What are the expected use cases for in env do ... end? As I'm understanding it, it basically just saves writing env.name for various reads and writes at the expense of losing access to other globals unless they are provided by env. So, it could be implemented as:

	do
		local _env = env
		... code with global accesses modified to reference _env ...
	end

Is this a correct understanding? That would seem to make sense as a syntactic replacement for some of the setfenv tricks but those tricks seem like tricks much of the time as opposed to particularly clean ways to write things. See the discussions about issues with the module function and package.seeall, for example.

Mark