lua-users home
lua-l archive

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

On Thu, May 5, 2011 at 10:53 PM, E. Toernig <> wrote:
> for _ENV in Interpreter do
>    AddItem "hello!"
>    AddItem(AN_UPVALUE)
>    AddItem "Hope You Enjoy!"
>    PrintResult()  --> hello! This is a silly DSL! Hope You Enjoy!
> end

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

for _ENV in env {print=print,A=1,B=2} do

The in statement reappears ...

steve d.