lua-users home
lua-l archive

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


On Apr 29, 2013, at 8:17 PM, Andrew Starks <andrew.starks@trms.com> wrote:

> Steve is an _ENV hater. I've given up on him. ;)

Haters gonna hate.

And there is nothing obviously 'tortured' about using _ENV:

--8<--

do
  local _ENV = {}
  _NAME = 'BAZ'
  function Foo() if _NAME then return end end
  function Bar() Foo() end
end

-->8--

Neither Steve's lglob...


$ lua lglob.lua TestGlobal.lua

lglob: TestGlobal.lua:3: undefined get _NAME
lglob: TestGlobal.lua:4: undefined get Foo


… nor Luiz's globals52...


$ luac -p -l TestGlobal.lua | lua globals52.lua | sort
TestGlobal.lua	3	undef	_NAME
TestGlobal.lua	4	undef	Foo


… can handle the most trivial _ENV usage… sigh… oh, well…

I'm at loss about all the hate. Give _ENV some love!