From 27d6efb5f5a076f825fe2da1875e0cabaf02b4e7 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 17 Nov 2021 23:03:07 +0800 Subject: + LuaMacro --- Tools/LuaMacro/tests/forall1.lua | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Tools/LuaMacro/tests/forall1.lua (limited to 'Tools/LuaMacro/tests/forall1.lua') 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) -- cgit v1.1-26-g67d0