diff options
Diffstat (limited to 'spec/inputs/macro.mp')
-rw-r--r-- | spec/inputs/macro.mp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/spec/inputs/macro.mp b/spec/inputs/macro.mp index 103df95..fafa522 100644 --- a/spec/inputs/macro.mp +++ b/spec/inputs/macro.mp | |||
@@ -1,11 +1,7 @@ | |||
1 | macro block init = -> | 1 | $ -> |
2 | with require "moonp" | 2 | package.moonpath = "?.mp;./spec/inputs/?.mp" |
3 | package.moonpath = "?.mp;./spec/inputs/?.mp" | ||
4 | "" | ||
5 | 3 | ||
6 | $init! | 4 | import "macro-export" as { |
7 | |||
8 | import "macro_export" as { | ||
9 | $, -- import all macros | 5 | $, -- import all macros |
10 | $config:$myconfig, -- rename macro $config to $myconfig | 6 | $config:$myconfig, -- rename macro $config to $myconfig |
11 | } | 7 | } |
@@ -125,6 +121,12 @@ end | |||
125 | x = x + f(3) | 121 | x = x + f(3) |
126 | ]] | 122 | ]] |
127 | 123 | ||
124 | $lua[[ | ||
125 | function tb:func() | ||
126 | print(123) | ||
127 | end | ||
128 | ]] | ||
129 | |||
128 | print x | 130 | print x |
129 | 131 | ||
130 | macro lua def = (fname, ...)-> | 132 | macro lua def = (fname, ...)-> |
@@ -144,8 +146,11 @@ $def sel, a, b, c, [[ | |||
144 | end | 146 | end |
145 | ]] | 147 | ]] |
146 | 148 | ||
147 | $def dummy,[[ | 149 | $def dummy,[[]] |
148 | ]] | 150 | |
151 | macro lua insertComment = (text)-> "-- #{text\match '[\'"](.*)[\'"]'}" | ||
152 | |||
153 | $insertComment "a comment here" | ||
149 | 154 | ||
150 | import 'underscore' as _ | 155 | import 'underscore' as _ |
151 | 156 | ||