diff options
author | Li Jin <dragon-fly@qq.com> | 2022-09-08 10:16:49 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2022-09-08 10:16:49 +0800 |
commit | 269b1fbf5d4d2c9ad33e75fb000d388b8391cb0f (patch) | |
tree | 56bd29e456a524699d365aef72b4063cdb630d18 /doc | |
parent | d4af1fa275b1d27229fc995f4a45137380040933 (diff) | |
download | yuescript-269b1fbf5d4d2c9ad33e75fb000d388b8391cb0f.tar.gz yuescript-269b1fbf5d4d2c9ad33e75fb000d388b8391cb0f.tar.bz2 yuescript-269b1fbf5d4d2c9ad33e75fb000d388b8391cb0f.zip |
fix doc.v0.15.1
Diffstat (limited to 'doc')
-rwxr-xr-x | doc/docs/doc/README.md | 22 |
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 |
70 | apple = | 70 | apple = |
71 | size: 15 | 71 | size: 15 |
72 | <index>: {color: 0x00ffff} | 72 | <index>: {color: 0x00ffff} |
73 | p apple.color, apple.<index> if apple.<>? | 73 | p apple.color, apple.<index> if apple.<>? |
74 | 74 | ||
75 | -- js-like export syntax | 75 | -- js-like export syntax |
76 | export yuescript = "月之脚本" | 76 | export yuescript = "月之脚本" |
@@ -452,18 +452,18 @@ close _ = <close>: -> print "out of scope" | |||
452 | <YueDisplay> | 452 | <YueDisplay> |
453 | <pre> | 453 | <pre> |
454 | mt = {} | 454 | mt = {} |
455 | add = (right)=> <>: mt, value: @value + right.value | 455 | add = (right)=> <>: mt, value: @value + right.value |
456 | mt.__add = add | 456 | mt.__add = add |
457 | 457 | ||
458 | a = <>: mt, value: 1 | 458 | a = <>: mt, value: 1 |
459 | -- set field with variable of the same name | 459 | -- set field with variable of the same name |
460 | b = :<add>, value: 2 | 460 | b = :<add>, value: 2 |
461 | c = <add>: mt.__add, value: 3 | 461 | c = <add>: mt.__add, value: 3 |
462 | 462 | ||
463 | d = a + b + c | 463 | d = a + b + c |
464 | print d.value | 464 | print d.value |
465 | 465 | ||
466 | close _ = <close>: -> print "out of scope" | 466 | close _ = <close>: -> 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" |
486 | tb = <"value">: 123 | 486 | tb = <"value">: 123 |
487 | tb.<index> = tb.<> | 487 | tb.<index> = tb.<> |
488 | print tb.value | 488 | print tb.value |
489 | tb.<> = __index: {item: "hello"} | 489 | tb.<> = __index: {item: "hello"} |
490 | print tb.item | 490 | print 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, :<close>, <index>: getter} = tb |
504 | print item, new, close, getter | 504 | print item, new, close, getter |
505 | </pre> | 505 | </pre> |
506 | </YueDisplay> | 506 | </YueDisplay> |