|
On 06/05/2011 15.23, steve donovan wrote: [...]
That is a very cute piece of code - bordering on abuse, maybe, but it looks good! Let me see if I get it: function env(tbl) return function(_,second_iteration) if second_iteration then return nil end return tbl end end for _ENV in env {print=print,A=1,B=2} do print(A,B) end The in statement reappears ... steve d.
Ok. But besides being a stress test for Lua 5.2 syntax and a proof of concept, isn't it a complicated way to do the following:
-------------- do local _ENV = {print=print,A=1,B=2} print(A,B) end ------------- in the end? Or am I missing something? Cheers. -- Lorenzo