lua-users home
lua-l archive

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


> what if environments had stacks?

We already have that. No need for a keyword.

	x=1
	print(x)
	do
		local _ENV={print=print}
		x=2
		print(x)
		do
			local _ENV={print=print}
			x=3
			print(x)
		end
		print(x)
	end
	print(x)

The _ENV mechanism was created exactly to allow this kind of thing
without resorting to magic.