summaryrefslogtreecommitdiff
path: root/Tools/LuaMacro/tests/forall1.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/LuaMacro/tests/forall1.lua')
-rw-r--r--Tools/LuaMacro/tests/forall1.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/Tools/LuaMacro/tests/forall1.lua b/Tools/LuaMacro/tests/forall1.lua
new file mode 100644
index 0000000..65589e2
--- /dev/null
+++ b/Tools/LuaMacro/tests/forall1.lua
@@ -0,0 +1,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)