aboutsummaryrefslogtreecommitdiff
path: root/doc/docs
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2021-11-25 11:25:39 +0800
committerLi Jin <dragon-fly@qq.com>2021-11-25 11:25:39 +0800
commit2d1a087a70272dc32183bbd3d5b0c036bc26ffdb (patch)
tree608a0842999768003585cb0b347550882fd08707 /doc/docs
parent65050db97932197ce990f36fc0efed8d0c1298a2 (diff)
downloadyuescript-2d1a087a70272dc32183bbd3d5b0c036bc26ffdb.tar.gz
yuescript-2d1a087a70272dc32183bbd3d5b0c036bc26ffdb.tar.bz2
yuescript-2d1a087a70272dc32183bbd3d5b0c036bc26ffdb.zip
fix doc.
Diffstat (limited to 'doc/docs')
-rwxr-xr-xdoc/docs/doc/README.md22
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] ...
168Macro function is used for evaluating a string in the compile time and insert the generated codes into final compilation. 168Macro 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
171macro PI2 = -> math.pi * 2
172area = $PI2 * 5
173
174macro HELLO = -> "'hello world'"
175print $HELLO
176
171macro config = (debugging)-> 177macro 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>
200macro PI2 = -> math.pi * 2
201area = $PI2 * 5
202
203macro HELLO = -> "'hello world'"
204print $HELLO
205
194macro config = (debugging)-> 206macro 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
227macro luaFunc = (var)-> { 239macro 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
233funcB = -> "assign the Lua defined variable" 245funcB = -> "assign the Lua defined variable"
234 246
235macro lua = (codes)-> { 247macro 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
256macro luaFunc = (var)-> { 268macro 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
262funcB = -> "assign the Lua defined variable" 274funcB = -> "assign the Lua defined variable"
263 275
264macro lua = (codes)-> { 276macro lua = (codes)-> {
265 :codes 277 :code
266 type: "lua" 278 type: "lua"
267} 279}
268 280