diff options
author | Li Jin <dragon-fly@qq.com> | 2021-11-25 11:25:39 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2021-11-25 11:25:39 +0800 |
commit | 2d1a087a70272dc32183bbd3d5b0c036bc26ffdb (patch) | |
tree | 608a0842999768003585cb0b347550882fd08707 /doc/docs | |
parent | 65050db97932197ce990f36fc0efed8d0c1298a2 (diff) | |
download | yuescript-2d1a087a70272dc32183bbd3d5b0c036bc26ffdb.tar.gz yuescript-2d1a087a70272dc32183bbd3d5b0c036bc26ffdb.tar.bz2 yuescript-2d1a087a70272dc32183bbd3d5b0c036bc26ffdb.zip |
fix doc.
Diffstat (limited to 'doc/docs')
-rwxr-xr-x | doc/docs/doc/README.md | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/doc/docs/doc/README.md b/doc/docs/doc/README.md index b4ae85f..371e681 100755 --- a/doc/docs/doc/README.md +++ b/doc/docs/doc/README.md | |||
@@ -168,6 +168,12 @@ Usage: yue [options|files|directories] ... | |||
168 | Macro function is used for evaluating a string in the compile time and insert the generated codes into final compilation. | 168 | Macro function is used for evaluating a string in the compile time and insert the generated codes into final compilation. |
169 | 169 | ||
170 | ```moonscript | 170 | ```moonscript |
171 | macro PI2 = -> math.pi * 2 | ||
172 | area = $PI2 * 5 | ||
173 | |||
174 | macro HELLO = -> "'hello world'" | ||
175 | print $HELLO | ||
176 | |||
171 | macro config = (debugging)-> | 177 | macro config = (debugging)-> |
172 | global debugMode = debugging == "true" | 178 | global debugMode = debugging == "true" |
173 | "" | 179 | "" |
@@ -191,6 +197,12 @@ if $and f1!, f2!, f3! | |||
191 | ``` | 197 | ``` |
192 | <YueDisplay> | 198 | <YueDisplay> |
193 | <pre> | 199 | <pre> |
200 | macro PI2 = -> math.pi * 2 | ||
201 | area = $PI2 * 5 | ||
202 | |||
203 | macro HELLO = -> "'hello world'" | ||
204 | print $HELLO | ||
205 | |||
194 | macro config = (debugging)-> | 206 | macro config = (debugging)-> |
195 | global debugMode = debugging == "true" | 207 | global debugMode = debugging == "true" |
196 | "" | 208 | "" |
@@ -225,15 +237,15 @@ funcA = -> "assign the Yue defined variable" | |||
225 | -- take care and let Yuescript know the | 237 | -- take care and let Yuescript know the |
226 | -- local variables you declared in Lua code | 238 | -- local variables you declared in Lua code |
227 | macro luaFunc = (var)-> { | 239 | macro luaFunc = (var)-> { |
228 | codes: "local function #{var}() end" | 240 | code: "local function #{var}() end" |
229 | type: "lua" | 241 | type: "lua" |
230 | locals: {var} | 242 | locals: {var} |
231 | } | 243 | } |
232 | $luaFunc funcB | 244 | $luaFunc funcB |
233 | funcB = -> "assign the Lua defined variable" | 245 | funcB = -> "assign the Lua defined variable" |
234 | 246 | ||
235 | macro lua = (codes)-> { | 247 | macro lua = (code)-> { |
236 | :codes | 248 | :code |
237 | type: "lua" | 249 | type: "lua" |
238 | } | 250 | } |
239 | 251 | ||
@@ -254,7 +266,7 @@ funcA = -> "assign the Yue defined variable" | |||
254 | -- take care and let Yuescript know the | 266 | -- take care and let Yuescript know the |
255 | -- local variables you declared in Lua codes | 267 | -- local variables you declared in Lua codes |
256 | macro luaFunc = (var)-> { | 268 | macro luaFunc = (var)-> { |
257 | codes: "local function #{var}() end" | 269 | code: "local function #{var}() end" |
258 | type: "lua" | 270 | type: "lua" |
259 | locals: {var} | 271 | locals: {var} |
260 | } | 272 | } |
@@ -262,7 +274,7 @@ $luaFunc funcB | |||
262 | funcB = -> "assign the Lua defined variable" | 274 | funcB = -> "assign the Lua defined variable" |
263 | 275 | ||
264 | macro lua = (codes)-> { | 276 | macro lua = (codes)-> { |
265 | :codes | 277 | :code |
266 | type: "lua" | 278 | type: "lua" |
267 | } | 279 | } |
268 | 280 | ||