summaryrefslogtreecommitdiff
path: root/Tools/LuaMacro/tests/forall1.lua
blob: 65589e21f8cd5092484b59f115ac7b0acdebf51e (plain)
1
2
3
4
5
6
7
8
local macro = require 'macro'

macro.define('forall',function(get)
  local var = get:iden()
  local t,v = get:next() -- will be 'in'
  local rest = tostring(get:upto 'do')
  return ('for _,%s in ipairs(%s) do'):format(var,rest)
end)