aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2022-09-08 10:16:49 +0800
committerLi Jin <dragon-fly@qq.com>2022-09-08 10:16:49 +0800
commit269b1fbf5d4d2c9ad33e75fb000d388b8391cb0f (patch)
tree56bd29e456a524699d365aef72b4063cdb630d18 /doc
parentd4af1fa275b1d27229fc995f4a45137380040933 (diff)
downloadyuescript-269b1fbf5d4d2c9ad33e75fb000d388b8391cb0f.tar.gz
yuescript-269b1fbf5d4d2c9ad33e75fb000d388b8391cb0f.tar.bz2
yuescript-269b1fbf5d4d2c9ad33e75fb000d388b8391cb0f.zip
fix doc.v0.15.1
Diffstat (limited to 'doc')
-rwxr-xr-xdoc/docs/doc/README.md22
1 files changed, 11 insertions, 11 deletions
diff --git a/doc/docs/doc/README.md b/doc/docs/doc/README.md
index 5e81d4c..46511ea 100755
--- a/doc/docs/doc/README.md
+++ b/doc/docs/doc/README.md
@@ -69,8 +69,8 @@ inventory =
69-- metatable manipulation 69-- metatable manipulation
70apple = 70apple =
71 size: 15 71 size: 15
72 <index>: {color: 0x00ffff} 72 &lt;index&gt;: {color: 0x00ffff}
73p apple.color, apple.<index> if apple.<>? 73p apple.color, apple.&lt;index&gt; if apple.&lt;&gt;?
74 74
75-- js-like export syntax 75-- js-like export syntax
76export yuescript = "月之脚本" 76export yuescript = "月之脚本"
@@ -452,18 +452,18 @@ close _ = <close>: -> print "out of scope"
452<YueDisplay> 452<YueDisplay>
453<pre> 453<pre>
454mt = {} 454mt = {}
455add = (right)=> <>: mt, value: @value + right.value 455add = (right)=> &lt;&gt;: mt, value: @value + right.value
456mt.__add = add 456mt.__add = add
457 457
458a = <>: mt, value: 1 458a = &lt;&gt;: mt, value: 1
459 -- set field with variable of the same name 459 -- set field with variable of the same name
460b = :<add>, value: 2 460b = :&lt;add&gt;, value: 2
461c = <add>: mt.__add, value: 3 461c = &lt;add&gt;: mt.__add, value: 3
462 462
463d = a + b + c 463d = a + b + c
464print d.value 464print d.value
465 465
466close _ = <close>: -> print "out of scope" 466close _ = &lt;close&gt;: -> print "out of scope"
467</pre> 467</pre>
468</YueDisplay> 468</YueDisplay>
469 469
@@ -483,10 +483,10 @@ print tb.item
483 483
484<pre> 484<pre>
485-- create with metatable containing field "value" 485-- create with metatable containing field "value"
486tb = <"value">: 123 486tb = &lt;"value"&gt;: 123
487tb.<index> = tb.<> 487tb.&lt;index&gt; = tb.&lt;&gt;
488print tb.value 488print tb.value
489tb.<> = __index: {item: "hello"} 489tb.&lt;&gt; = __index: {item: "hello"}
490print tb.item 490print tb.item
491</pre> 491</pre>
492</YueDisplay> 492</YueDisplay>
@@ -500,7 +500,7 @@ print item, new, close, getter
500``` 500```
501<YueDisplay> 501<YueDisplay>
502<pre> 502<pre>
503{item, :new, :<close>, <index>: getter} = tb 503{item, :new, :&lt;close&gt;, &lt;index&gt;: getter} = tb
504print item, new, close, getter 504print item, new, close, getter
505</pre> 505</pre>
506</YueDisplay> 506</YueDisplay>