diff options
| author | Li Jin <dragon-fly@qq.com> | 2026-02-03 22:42:37 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2026-02-03 22:42:37 +0800 |
| commit | e4f8d1b3b075323968bb6dc334226dff33c0a2b0 (patch) | |
| tree | 657e1ac82e54b91014dc12d15e90329bf66f9d0f /spec/outputs/codes_from_doc.lua | |
| parent | ca1ec12725c32b0173692e01259570966da8a9a6 (diff) | |
| download | yuescript-e4f8d1b3b075323968bb6dc334226dff33c0a2b0.tar.gz yuescript-e4f8d1b3b075323968bb6dc334226dff33c0a2b0.tar.bz2 yuescript-e4f8d1b3b075323968bb6dc334226dff33c0a2b0.zip | |
Updated doc.
Diffstat (limited to 'spec/outputs/codes_from_doc.lua')
| -rw-r--r-- | spec/outputs/codes_from_doc.lua | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/spec/outputs/codes_from_doc.lua b/spec/outputs/codes_from_doc.lua index 3b0724a..b8985e7 100644 --- a/spec/outputs/codes_from_doc.lua +++ b/spec/outputs/codes_from_doc.lua | |||
| @@ -107,7 +107,7 @@ if cond then | |||
| 107 | end | 107 | end |
| 108 | end | 108 | end |
| 109 | print("yuescript") | 109 | print("yuescript") |
| 110 | print(3) | 110 | print(2) |
| 111 | print("Valid enum type:", "Static") | 111 | print("Valid enum type:", "Static") |
| 112 | do | 112 | do |
| 113 | print(123, "hello") | 113 | print(123, "hello") |
| @@ -992,6 +992,36 @@ local arg1 = { | |||
| 992 | a = 0 | 992 | a = 0 |
| 993 | } | 993 | } |
| 994 | f2(arg1, arg2) | 994 | f2(arg1, arg2) |
| 995 | local findFirstEven | ||
| 996 | findFirstEven = function(list) | ||
| 997 | for _index_0 = 1, #list do | ||
| 998 | local item = list[_index_0] | ||
| 999 | if type(item) == "table" then | ||
| 1000 | for _index_1 = 1, #item do | ||
| 1001 | local sub = item[_index_1] | ||
| 1002 | if sub % 2 == 0 then | ||
| 1003 | return sub | ||
| 1004 | end | ||
| 1005 | end | ||
| 1006 | end | ||
| 1007 | end | ||
| 1008 | return nil | ||
| 1009 | end | ||
| 1010 | local findFirstEven | ||
| 1011 | findFirstEven = function(list) | ||
| 1012 | for _index_0 = 1, #list do | ||
| 1013 | local item = list[_index_0] | ||
| 1014 | if type(item) == "table" then | ||
| 1015 | for _index_1 = 1, #item do | ||
| 1016 | local sub = item[_index_1] | ||
| 1017 | if sub % 2 == 0 then | ||
| 1018 | return sub | ||
| 1019 | end | ||
| 1020 | end | ||
| 1021 | end | ||
| 1022 | end | ||
| 1023 | return nil | ||
| 1024 | end | ||
| 995 | local f | 1025 | local f |
| 996 | f = function(...) | 1026 | f = function(...) |
| 997 | local t = { | 1027 | local t = { |
| @@ -2637,7 +2667,7 @@ if cond then | |||
| 2637 | end | 2667 | end |
| 2638 | end | 2668 | end |
| 2639 | print("yuescript") | 2669 | print("yuescript") |
| 2640 | print(3) | 2670 | print(2) |
| 2641 | print("Valid enum type:", "Static") | 2671 | print("Valid enum type:", "Static") |
| 2642 | do | 2672 | do |
| 2643 | print(123, "hello") | 2673 | print(123, "hello") |
