lua-users home
lua-l archive

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

I found the way to do it in lua without preprocessing. But only in 5.4.
There is 4-th parameter in for loop introduced in lua 5.4 so
now it look like:

require "scope54" --

for auto,defer in scope() do
  defer(function() print"defer" end)
  local f=auto(io.close){ "scope54.lua"}

I think this is enough readable and looks nice.

вт, 9 июл. 2019 г. в 02:54, Coda Highland <>:
> Well YEAH, of course you can do it if you add a preprocessing phase. That's cheating. :P It's not really Lua anymore if you do that.
> /s/ Adam