aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2026-02-06 11:54:32 +0800
committerLi Jin <dragon-fly@qq.com>2026-02-06 11:54:32 +0800
commit1f83d504bc344ffd3c8b4120b3865fd6c11a9e2d (patch)
tree1d5c39eadcbe086d2a592ac76c8f1d288adfbe9d /spec
parentaa3ecc7badfb39cb9167fb95c9a678257c1d9954 (diff)
downloadyuescript-1f83d504bc344ffd3c8b4120b3865fd6c11a9e2d.tar.gz
yuescript-1f83d504bc344ffd3c8b4120b3865fd6c11a9e2d.tar.bz2
yuescript-1f83d504bc344ffd3c8b4120b3865fd6c11a9e2d.zip
Updated docs.v0.32.9
Diffstat (limited to 'spec')
-rw-r--r--spec/outputs/codes_from_doc_de.lua554
-rw-r--r--spec/outputs/codes_from_doc_en.lua10
-rw-r--r--spec/outputs/codes_from_doc_id-id.lua86
-rw-r--r--spec/outputs/codes_from_doc_pt-br.lua226
-rw-r--r--spec/outputs/codes_from_doc_zh.lua6
5 files changed, 426 insertions, 456 deletions
diff --git a/spec/outputs/codes_from_doc_de.lua b/spec/outputs/codes_from_doc_de.lua
index 0b3670c..44fc28a 100644
--- a/spec/outputs/codes_from_doc_de.lua
+++ b/spec/outputs/codes_from_doc_de.lua
@@ -1,5 +1,5 @@
1do 1do
2 local var = "hello" 2 local var = "hallo"
3 print(var) 3 print(var)
4end 4end
5print(var) 5print(var)
@@ -15,12 +15,12 @@ print(counter())
15print(counter()) 15print(counter())
16local tbl = { 16local tbl = {
17 key = (function() 17 key = (function()
18 print("assigning key!") 18 print("Schlüssel wird zugewiesen!")
19 return 1234 19 return 1234
20 end)() 20 end)()
21} 21}
22do 22do
23 local var = "hello" 23 local var = "hallo"
24 print(var) 24 print(var)
25end 25end
26print(var) 26print(var)
@@ -36,17 +36,17 @@ print(counter())
36print(counter()) 36print(counter())
37local tbl = { 37local tbl = {
38 key = (function() 38 key = (function()
39 print("assigning key!") 39 print("Schlüssel wird zugewiesen!")
40 return 1234 40 return 1234
41 end)() 41 end)()
42} 42}
43if name == "Rob" then 43if name == "Rob" then
44 print("hello world") 44 print("Hallo Welt")
45end 45end
46local _list_0 = items 46local _list_0 = items
47for _index_0 = 1, #_list_0 do 47for _index_0 = 1, #_list_0 do
48 local item = _list_0[_index_0] 48 local item = _list_0[_index_0]
49 print("item: ", item) 49 print("Element: ", item)
50end 50end
51while game:isRunning() do 51while game:isRunning() do
52 game:update() 52 game:update()
@@ -55,12 +55,12 @@ while not reader:eof() do
55 reader:parse_line() 55 reader:parse_line()
56end 56end
57if name == "Rob" then 57if name == "Rob" then
58 print("hello world") 58 print("Hallo Welt")
59end 59end
60local _list_0 = items 60local _list_0 = items
61for _index_0 = 1, #_list_0 do 61for _index_0 = 1, #_list_0 do
62 local item = _list_0[_index_0] 62 local item = _list_0[_index_0]
63 print("item: ", item) 63 print("Element: ", item)
64end 64end
65while game:isRunning() do 65while game:isRunning() do
66 game:update() 66 game:update()
@@ -69,7 +69,7 @@ while not reader:eof() do
69 reader:parse_line() 69 reader:parse_line()
70end 70end
71local area = 6.2831853071796 * 5 71local area = 6.2831853071796 * 5
72print('hello world') 72print('Hallo Welt')
73do 73do
74 assert(item ~= nil) 74 assert(item ~= nil)
75end 75end
@@ -83,32 +83,32 @@ do
83end 83end
84local funcA 84local funcA
85funcA = function() 85funcA = function()
86 return "fail to assign to the Yue macro defined variable" 86 return "Zuweisung an die vom Yue-Makro definierte Variable schlägt fehl"
87end 87end
88do 88do
89local function funcB() end 89local function funcB() end
90end 90end
91local funcB 91local funcB
92funcB = function() 92funcB = function()
93 return "fail to assign to the Lua macro defined variable" 93 return "Zuweisung an die vom Lua-Makro definierte Variable schlägt fehl"
94end 94end
95do 95do
96-- raw Lua codes insertion 96-- Einfügen von rohem Lua-Code
97if cond then 97if cond then
98 print("output") 98 print("Ausgabe")
99end 99end
100end 100end
101print("yuescript") 101print("yuescript")
102print(2) 102print(2)
103print("Valid enum type:", "Static") 103print("ltiger Enum-Typ:", "Static")
104do 104do
105 print(123, "hello") 105 print(123, "hallo")
106end 106end
107do 107do
108 print(123, "hello") 108 print(123, "hallo")
109end 109end
110local area = 6.2831853071796 * 5 110local area = 6.2831853071796 * 5
111print('hello world') 111print('Hallo Welt')
112do 112do
113 assert(item ~= nil) 113 assert(item ~= nil)
114end 114end
@@ -122,29 +122,29 @@ do
122end 122end
123local funcA 123local funcA
124funcA = function() 124funcA = function()
125 return "fail to assign to the Yue macro defined variable" 125 return "Zuweisung an die vom Yue-Makro definierte Variable schlägt fehl"
126end 126end
127do 127do
128local function funcB() end 128local function funcB() end
129end 129end
130local funcB 130local funcB
131funcB = function() 131funcB = function()
132 return "fail to assign to the Lua macro defined variable" 132 return "Zuweisung an die vom Lua-Makro definierte Variable schlägt fehl"
133end 133end
134do 134do
135-- raw Lua codes insertion 135-- Einfügen von rohem Lua-Code
136if cond then 136if cond then
137 print("output") 137 print("Ausgabe")
138end 138end
139end 139end
140print("yuescript") 140print("yuescript")
141print(2) 141print(2)
142print("Valid enum type:", "Static") 142print("ltiger Enum-Typ:", "Static")
143do 143do
144 print(123, "hello") 144 print(123, "hallo")
145end 145end
146do 146do
147 print(123, "hello") 147 print(123, "hallo")
148end 148end
149do 149do
150 local insert, concat = table.insert, table.concat 150 local insert, concat = table.insert, table.concat
@@ -190,7 +190,7 @@ end
190do 190do
191 local print <const> = print 191 local print <const> = print
192 local math <const> = math 192 local math <const> = math
193 print("hello") 193 print("hallo")
194 math.random(3) 194 math.random(3)
195end 195end
196do 196do
@@ -201,7 +201,7 @@ end
201local _module_0 = { } 201local _module_0 = { }
202local a, b, c = 1, 2, 3 202local a, b, c = 1, 2, 3
203_module_0["a"], _module_0["b"], _module_0["c"] = a, b, c 203_module_0["a"], _module_0["b"], _module_0["c"] = a, b, c
204local cool = "cat" 204local cool = "Katze"
205_module_0["cool"] = cool 205_module_0["cool"] = cool
206local What 206local What
207if this then 207if this then
@@ -273,7 +273,7 @@ _module_0[#_module_0 + 1] = _with_0
273return _module_0 273return _module_0
274local _module_0 = nil 274local _module_0 = nil
275_module_0 = function() 275_module_0 = function()
276 print("hello") 276 print("hallo")
277 return 123 277 return 123
278end 278end
279return _module_0 279return _module_0
@@ -321,7 +321,7 @@ end
321do 321do
322 local print <const> = print 322 local print <const> = print
323 local math <const> = math 323 local math <const> = math
324 print("hello") 324 print("hallo")
325 math.random(3) 325 math.random(3)
326end 326end
327do 327do
@@ -332,7 +332,7 @@ end
332local _module_0 = { } 332local _module_0 = { }
333local a, b, c = 1, 2, 3 333local a, b, c = 1, 2, 3
334_module_0["a"], _module_0["b"], _module_0["c"] = a, b, c 334_module_0["a"], _module_0["b"], _module_0["c"] = a, b, c
335local cool = "cat" 335local cool = "Katze"
336_module_0["cool"] = cool 336_module_0["cool"] = cool
337local What 337local What
338if this then 338if this then
@@ -404,7 +404,7 @@ _module_0[#_module_0 + 1] = _with_0
404return _module_0 404return _module_0
405local _module_0 = nil 405local _module_0 = nil
406_module_0 = function() 406_module_0 = function()
407 print("hello") 407 print("hallo")
408 return 123 408 return 123
409end 409end
410return _module_0 410return _module_0
@@ -427,7 +427,7 @@ success, result = pcall(function()
427 return func(1, 2, 3) 427 return func(1, 2, 3)
428end) 428end)
429pcall(function() 429pcall(function()
430 print("trying") 430 print("Versuche")
431 return func(1, 2, 3) 431 return func(1, 2, 3)
432end) 432end)
433success, result = xpcall(function() 433success, result = xpcall(function()
@@ -461,7 +461,7 @@ do
461 if _exp_0 ~= nil then 461 if _exp_0 ~= nil then
462 a = _exp_0 462 a = _exp_0
463 else 463 else
464 a = "default" 464 a = "Standardwert"
465 end 465 end
466end 466end
467f((function() 467f((function()
@@ -507,7 +507,7 @@ success, result = pcall(function()
507 return func(1, 2, 3) 507 return func(1, 2, 3)
508end) 508end)
509pcall(function() 509pcall(function()
510 print("trying") 510 print("Versuche")
511 return func(1, 2, 3) 511 return func(1, 2, 3)
512end) 512end)
513success, result = xpcall(function() 513success, result = xpcall(function()
@@ -541,7 +541,7 @@ do
541 if _exp_0 ~= nil then 541 if _exp_0 ~= nil then
542 a = _exp_0 542 a = _exp_0
543 else 543 else
544 a = "default" 544 a = "Standardwert"
545 end 545 end
546end 546end
547f((function() 547f((function()
@@ -577,14 +577,14 @@ local some_values = {
577local some_values = { 577local some_values = {
578 name = "Bill", 578 name = "Bill",
579 age = 200, 579 age = 200,
580 ["favorite food"] = "rice" 580 ["Lieblingsessen"] = "Reis"
581} 581}
582local profile = { 582local profile = {
583 height = "4 feet", 583 height = "4 Fuß",
584 shoe_size = 13, 584 shoe_size = 13,
585 favorite_foods = { 585 favorite_foods = {
586 "ice cream", 586 "Eis",
587 "donuts" 587 "Donuts"
588 } 588 }
589} 589}
590local values = { 590local values = {
@@ -596,21 +596,21 @@ local values = {
596 6, 596 6,
597 7, 597 7,
598 8, 598 8,
599 name = "superman", 599 name = "Superman",
600 occupation = "crime fighting" 600 occupation = "Verbrechensbekämpfung"
601} 601}
602my_function({ 602my_function({
603 dance = "Tango", 603 dance = "Tango",
604 partner = "none" 604 partner = "keiner"
605}) 605})
606local y = { 606local y = {
607 type = "dog", 607 type = "Hund",
608 legs = 4, 608 legs = 4,
609 tails = 1 609 tails = 1
610} 610}
611local tbl = { 611local tbl = {
612 ["do"] = "something", 612 ["do"] = "etwas",
613 ["end"] = "hunger" 613 ["end"] = "Hunger"
614} 614}
615local hair = "golden" 615local hair = "golden"
616local height = 200 616local height = 200
@@ -624,8 +624,8 @@ print_table({
624 height = height 624 height = height
625}) 625})
626local t = { 626local t = {
627 [1 + 2] = "hello", 627 [1 + 2] = "hallo",
628 ["hello world"] = true 628 ["Hallo Welt"] = true
629} 629}
630local some_values = { 630local some_values = {
631 1, 631 1,
@@ -645,14 +645,14 @@ local some_values = {
645local some_values = { 645local some_values = {
646 name = "Bill", 646 name = "Bill",
647 age = 200, 647 age = 200,
648 ["favorite food"] = "rice" 648 ["Lieblingsessen"] = "Reis"
649} 649}
650local profile = { 650local profile = {
651 height = "4 feet", 651 height = "4 Fuß",
652 shoe_size = 13, 652 shoe_size = 13,
653 favorite_foods = { 653 favorite_foods = {
654 "ice cream", 654 "Eis",
655 "donuts" 655 "Donuts"
656 } 656 }
657} 657}
658local values = { 658local values = {
@@ -664,21 +664,21 @@ local values = {
664 6, 664 6,
665 7, 665 7,
666 8, 666 8,
667 name = "superman", 667 name = "Superman",
668 occupation = "crime fighting" 668 occupation = "Verbrechensbekämpfung"
669} 669}
670my_function({ 670my_function({
671 dance = "Tango", 671 dance = "Tango",
672 partner = "none" 672 partner = "keiner"
673}) 673})
674local y = { 674local y = {
675 type = "dog", 675 type = "Hund",
676 legs = 4, 676 legs = 4,
677 tails = 1 677 tails = 1
678} 678}
679local tbl = { 679local tbl = {
680 ["do"] = "something", 680 ["do"] = "etwas",
681 ["end"] = "hunger" 681 ["end"] = "Hunger"
682} 682}
683local hair = "golden" 683local hair = "golden"
684local height = 200 684local height = 200
@@ -692,8 +692,8 @@ print_table({
692 height = height 692 height = height
693}) 693})
694local t = { 694local t = {
695 [1 + 2] = "hello", 695 [1 + 2] = "hallo",
696 ["hello world"] = true 696 ["Hallo Welt"] = true
697} 697}
698local some_values = { 698local some_values = {
699 1, 699 1,
@@ -797,8 +797,8 @@ for i = 1, 100 do
797end 797end
798evens = _accum_0 798evens = _accum_0
799local thing = { 799local thing = {
800 color = "red", 800 color = "rot",
801 name = "fast", 801 name = "schnell",
802 width = 123 802 width = 123
803} 803}
804local thing_copy 804local thing_copy
@@ -830,8 +830,8 @@ end
830sqrts = _tbl_0 830sqrts = _tbl_0
831local tuples = { 831local tuples = {
832 { 832 {
833 "hello", 833 "hallo",
834 "world" 834 "Welt"
835 }, 835 },
836 { 836 {
837 "foo", 837 "foo",
@@ -1018,8 +1018,8 @@ for i = 1, 100 do
1018end 1018end
1019evens = _accum_0 1019evens = _accum_0
1020local thing = { 1020local thing = {
1021 color = "red", 1021 color = "rot",
1022 name = "fast", 1022 name = "schnell",
1023 width = 123 1023 width = 123
1024} 1024}
1025local thing_copy 1025local thing_copy
@@ -1051,8 +1051,8 @@ end
1051sqrts = _tbl_0 1051sqrts = _tbl_0
1052local tuples = { 1052local tuples = {
1053 { 1053 {
1054 "hello", 1054 "hallo",
1055 "world" 1055 "Welt"
1056 }, 1056 },
1057 { 1057 {
1058 "foo", 1058 "foo",
@@ -1178,8 +1178,8 @@ _class_0 = setmetatable({
1178_base_0.__class = _class_0 1178_base_0.__class = _class_0
1179Inventory = _class_0 1179Inventory = _class_0
1180local inv = Inventory() 1180local inv = Inventory()
1181inv:add_item("t-shirt") 1181inv:add_item("T-Shirt")
1182inv:add_item("pants") 1182inv:add_item("Hose")
1183local Person 1183local Person
1184do 1184do
1185 local _class_0 1185 local _class_0
@@ -1209,8 +1209,8 @@ do
1209end 1209end
1210local a = Person() 1210local a = Person()
1211local b = Person() 1211local b = Person()
1212a:give_item("pants") 1212a:give_item("Hose")
1213b:give_item("shirt") 1213b:give_item("Hemd")
1214local _list_0 = a.clothes 1214local _list_0 = a.clothes
1215for _index_0 = 1, #_list_0 do 1215for _index_0 = 1, #_list_0 do
1216 local item = _list_0[_index_0] 1216 local item = _list_0[_index_0]
@@ -1245,7 +1245,7 @@ local _base_0 = {
1245 size = 10, 1245 size = 10,
1246 add_item = function(self, name) 1246 add_item = function(self, name)
1247 if #self.items > size then 1247 if #self.items > size then
1248 error("backpack is full") 1248 error("Rucksack ist voll")
1249 end 1249 end
1250 return _class_0.__parent.__base.add_item(self, name) 1250 return _class_0.__parent.__base.add_item(self, name)
1251 end 1251 end
@@ -1311,7 +1311,7 @@ do
1311 _base_0.__class = _class_0 1311 _base_0.__class = _class_0
1312 local self = _class_0; 1312 local self = _class_0;
1313 self.__inherited = function(self, child) 1313 self.__inherited = function(self, child)
1314 return print(self.__name, "was inherited by", child.__name) 1314 return print(self.__name, "wurde vererbt von", child.__name)
1315 end 1315 end
1316 Shelf = _class_0 1316 Shelf = _class_0
1317end 1317end
@@ -1363,9 +1363,9 @@ local _class_0
1363local _parent_0 = ParentClass 1363local _parent_0 = ParentClass
1364local _base_0 = { 1364local _base_0 = {
1365 a_method = function(self) 1365 a_method = function(self)
1366 _class_0.__parent.__base.a_method(self, "hello", "world") 1366 _class_0.__parent.__base.a_method(self, "hallo", "Welt")
1367 _class_0.__parent.a_method(self, "hello", "world") 1367 _class_0.__parent.a_method(self, "hallo", "Welt")
1368 _class_0.__parent.a_method(self, "hello", "world") 1368 _class_0.__parent.a_method(self, "hallo", "Welt")
1369 return assert(_class_0.__parent == ParentClass) 1369 return assert(_class_0.__parent == ParentClass)
1370 end 1370 end
1371} 1371}
@@ -1434,7 +1434,7 @@ do
1434 _base_0.__class = _class_0 1434 _base_0.__class = _class_0
1435 local self = _class_0; 1435 local self = _class_0;
1436 self.some_func = function(self) 1436 self.some_func = function(self)
1437 return print("Hello from", self.__name) 1437 return print("Hallo von", self.__name)
1438 end 1438 end
1439 Things = _class_0 1439 Things = _class_0
1440end 1440end
@@ -1490,14 +1490,14 @@ _class_0 = setmetatable({
1490}) 1490})
1491_base_0.__class = _class_0 1491_base_0.__class = _class_0
1492local self = _class_0; 1492local self = _class_0;
1493self.class_var = "hello world" 1493self.class_var = "Hallo Welt"
1494Things = _class_0 1494Things = _class_0
1495local MoreThings 1495local MoreThings
1496local _class_0 1496local _class_0
1497local secret, log 1497local secret, log
1498local _base_0 = { 1498local _base_0 = {
1499 some_method = function(self) 1499 some_method = function(self)
1500 return log("hello world: " .. secret) 1500 return log("Hallo Welt: " .. secret)
1501 end 1501 end
1502} 1502}
1503if _base_0.__index == nil then 1503if _base_0.__index == nil then
@@ -1798,8 +1798,8 @@ _class_0 = setmetatable({
1798_base_0.__class = _class_0 1798_base_0.__class = _class_0
1799Inventory = _class_0 1799Inventory = _class_0
1800local inv = Inventory() 1800local inv = Inventory()
1801inv:add_item("t-shirt") 1801inv:add_item("T-Shirt")
1802inv:add_item("pants") 1802inv:add_item("Hose")
1803local Person 1803local Person
1804do 1804do
1805 local _class_0 1805 local _class_0
@@ -1829,8 +1829,8 @@ do
1829end 1829end
1830local a = Person() 1830local a = Person()
1831local b = Person() 1831local b = Person()
1832a:give_item("pants") 1832a:give_item("Hose")
1833b:give_item("shirt") 1833b:give_item("Hemd")
1834local _list_0 = a.clothes 1834local _list_0 = a.clothes
1835for _index_0 = 1, #_list_0 do 1835for _index_0 = 1, #_list_0 do
1836 local item = _list_0[_index_0] 1836 local item = _list_0[_index_0]
@@ -1865,7 +1865,7 @@ local _base_0 = {
1865 size = 10, 1865 size = 10,
1866 add_item = function(self, name) 1866 add_item = function(self, name)
1867 if #self.items > size then 1867 if #self.items > size then
1868 error("backpack is full") 1868 error("Rucksack ist voll")
1869 end 1869 end
1870 return _class_0.__parent.__base.add_item(self, name) 1870 return _class_0.__parent.__base.add_item(self, name)
1871 end 1871 end
@@ -1931,7 +1931,7 @@ do
1931 _base_0.__class = _class_0 1931 _base_0.__class = _class_0
1932 local self = _class_0; 1932 local self = _class_0;
1933 self.__inherited = function(self, child) 1933 self.__inherited = function(self, child)
1934 return print(self.__name, "was inherited by", child.__name) 1934 return print(self.__name, "wurde vererbt von", child.__name)
1935 end 1935 end
1936 Shelf = _class_0 1936 Shelf = _class_0
1937end 1937end
@@ -1983,9 +1983,9 @@ local _class_0
1983local _parent_0 = ParentClass 1983local _parent_0 = ParentClass
1984local _base_0 = { 1984local _base_0 = {
1985 a_method = function(self) 1985 a_method = function(self)
1986 _class_0.__parent.__base.a_method(self, "hello", "world") 1986 _class_0.__parent.__base.a_method(self, "hallo", "Welt")
1987 _class_0.__parent.a_method(self, "hello", "world") 1987 _class_0.__parent.a_method(self, "hallo", "Welt")
1988 _class_0.__parent.a_method(self, "hello", "world") 1988 _class_0.__parent.a_method(self, "hallo", "Welt")
1989 return assert(_class_0.__parent == ParentClass) 1989 return assert(_class_0.__parent == ParentClass)
1990 end 1990 end
1991} 1991}
@@ -2054,7 +2054,7 @@ do
2054 _base_0.__class = _class_0 2054 _base_0.__class = _class_0
2055 local self = _class_0; 2055 local self = _class_0;
2056 self.some_func = function(self) 2056 self.some_func = function(self)
2057 return print("Hello from", self.__name) 2057 return print("Hallo von", self.__name)
2058 end 2058 end
2059 Things = _class_0 2059 Things = _class_0
2060end 2060end
@@ -2110,14 +2110,14 @@ _class_0 = setmetatable({
2110}) 2110})
2111_base_0.__class = _class_0 2111_base_0.__class = _class_0
2112local self = _class_0; 2112local self = _class_0;
2113self.class_var = "hello world" 2113self.class_var = "Hallo Welt"
2114Things = _class_0 2114Things = _class_0
2115local MoreThings 2115local MoreThings
2116local _class_0 2116local _class_0
2117local secret, log 2117local secret, log
2118local _base_0 = { 2118local _base_0 = {
2119 some_method = function(self) 2119 some_method = function(self)
2120 return log("hello world: " .. secret) 2120 return log("Hallo Welt: " .. secret)
2121 end 2121 end
2122} 2122}
2123if _base_0.__index == nil then 2123if _base_0.__index == nil then
@@ -2392,7 +2392,7 @@ _with_0:add_relative(my_dad)
2392_with_0:save() 2392_with_0:save()
2393print(_with_0.name) 2393print(_with_0.name)
2394local file 2394local file
2395local _with_0 = File("favorite_foods.txt") 2395local _with_0 = File("Lieblingsessen.txt")
2396_with_0:set_encoding("utf8") 2396_with_0:set_encoding("utf8")
2397file = _with_0 2397file = _with_0
2398local create_person 2398local create_person
@@ -2410,9 +2410,9 @@ local me = create_person("Leaf", {
2410 mother, 2410 mother,
2411 sister 2411 sister
2412}) 2412})
2413local str = "Hello" 2413local str = "Hallo"
2414print("original:", str) 2414print("Original:", str)
2415print("upper:", str:upper()) 2415print("Großbuchstaben:", str:upper())
2416local _with_0 = tb 2416local _with_0 = tb
2417_with_0[1] = 1 2417_with_0[1] = 1
2418print(_with_0[2]) 2418print(_with_0[2])
@@ -2432,7 +2432,7 @@ _with_0:add_relative(my_dad)
2432_with_0:save() 2432_with_0:save()
2433print(_with_0.name) 2433print(_with_0.name)
2434local file 2434local file
2435local _with_0 = File("favorite_foods.txt") 2435local _with_0 = File("Lieblingsessen.txt")
2436_with_0:set_encoding("utf8") 2436_with_0:set_encoding("utf8")
2437file = _with_0 2437file = _with_0
2438local create_person 2438local create_person
@@ -2450,9 +2450,9 @@ local me = create_person("Leaf", {
2450 mother, 2450 mother,
2451 sister 2451 sister
2452}) 2452})
2453local str = "Hello" 2453local str = "Hallo"
2454print("original:", str) 2454print("Original:", str)
2455print("upper:", str:upper()) 2455print("Großbuchstaben:", str:upper())
2456local _with_0 = tb 2456local _with_0 = tb
2457_with_0[1] = 1 2457_with_0[1] = 1
2458print(_with_0[2]) 2458print(_with_0[2])
@@ -2608,18 +2608,18 @@ if user then
2608end 2608end
2609local hello = os.getenv("hello") 2609local hello = os.getenv("hello")
2610if hello then 2610if hello then
2611 print("You have hello", hello) 2611 print("Du hast hello", hello)
2612else 2612else
2613 local world = os.getenv("world") 2613 local world = os.getenv("world")
2614 if world then 2614 if world then
2615 print("you have world", world) 2615 print("Du hast world", world)
2616 else 2616 else
2617 print("nothing :(") 2617 print("nichts :(")
2618 end 2618 end
2619end 2619end
2620do 2620do
2621 local success, result = pcall(function() 2621 local success, result = pcall(function()
2622 return "get result without problems" 2622 return "Ergebnis ohne Probleme erhalten"
2623 end) 2623 end)
2624 if success then 2624 if success then
2625 print(result) 2625 print(result)
@@ -2640,18 +2640,18 @@ if user then
2640end 2640end
2641local hello = os.getenv("hello") 2641local hello = os.getenv("hello")
2642if hello then 2642if hello then
2643 print("You have hello", hello) 2643 print("Du hast hello", hello)
2644else 2644else
2645 local world = os.getenv("world") 2645 local world = os.getenv("world")
2646 if world then 2646 if world then
2647 print("you have world", world) 2647 print("Du hast world", world)
2648 else 2648 else
2649 print("nothing :(") 2649 print("nichts :(")
2650 end 2650 end
2651end 2651end
2652do 2652do
2653 local success, result = pcall(function() 2653 local success, result = pcall(function()
2654 return "get result without problems" 2654 return "Ergebnis ohne Probleme erhalten"
2655 end) 2655 end)
2656 if success then 2656 if success then
2657 print(result) 2657 print(result)
@@ -2673,8 +2673,8 @@ local thing = {
2673local a, b = thing[1], thing[2] 2673local a, b = thing[1], thing[2]
2674print(a, b) 2674print(a, b)
2675local obj = { 2675local obj = {
2676 hello = "world", 2676 hello = "Welt",
2677 day = "tuesday", 2677 day = "Dienstag",
2678 length = 20 2678 length = 20
2679} 2679}
2680local hello, the_day = obj.hello, obj.day 2680local hello, the_day = obj.hello, obj.day
@@ -2688,7 +2688,7 @@ local obj2 = {
2688 4 2688 4
2689 }, 2689 },
2690 properties = { 2690 properties = {
2691 color = "green", 2691 color = "grün",
2692 height = 13.5 2692 height = 13.5
2693 } 2693 }
2694} 2694}
@@ -2707,20 +2707,20 @@ local name, job
2707local _obj_0 = person 2707local _obj_0 = person
2708name, job = _obj_0.name, _obj_0.job 2708name, job = _obj_0.name, _obj_0.job
2709if name == nil then 2709if name == nil then
2710 name = "nameless" 2710 name = "namenlos"
2711end 2711end
2712if job == nil then 2712if job == nil then
2713 job = "jobless" 2713 job = "arbeitlos"
2714end 2714end
2715local two, four 2715local two, four
2716local _obj_0 = items 2716local _obj_0 = items
2717two, four = _obj_0[2], _obj_0[4] 2717two, four = _obj_0[2], _obj_0[4]
2718local orders = { 2718local orders = {
2719 "first", 2719 "erster",
2720 "second", 2720 "zweiter",
2721 "third", 2721 "dritter",
2722 "fourth", 2722 "vierter",
2723 "last" 2723 "letzter"
2724} 2724}
2725local first, bulk, last = orders[1], (function() 2725local first, bulk, last = orders[1], (function()
2726 local _accum_0 = { } 2726 local _accum_0 = { }
@@ -2770,12 +2770,12 @@ local _obj_0 = orders
2770first, last = _obj_0[1], _obj_0[#_obj_0] 2770first, last = _obj_0[1], _obj_0[#_obj_0]
2771local tuples = { 2771local tuples = {
2772 { 2772 {
2773 "hello", 2773 "hallo",
2774 "world" 2774 "Welt"
2775 }, 2775 },
2776 { 2776 {
2777 "egg", 2777 "Ei",
2778 "head" 2778 "Kopf"
2779 } 2779 }
2780} 2780}
2781for _index_0 = 1, #tuples do 2781for _index_0 = 1, #tuples do
@@ -2790,8 +2790,8 @@ local thing = {
2790local a, b = thing[1], thing[2] 2790local a, b = thing[1], thing[2]
2791print(a, b) 2791print(a, b)
2792local obj = { 2792local obj = {
2793 hello = "world", 2793 hello = "Welt",
2794 day = "tuesday", 2794 day = "Dienstag",
2795 length = 20 2795 length = 20
2796} 2796}
2797local hello, the_day = obj.hello, obj.day 2797local hello, the_day = obj.hello, obj.day
@@ -2805,7 +2805,7 @@ local obj2 = {
2805 4 2805 4
2806 }, 2806 },
2807 properties = { 2807 properties = {
2808 color = "green", 2808 color = "grün",
2809 height = 13.5 2809 height = 13.5
2810 } 2810 }
2811} 2811}
@@ -2824,20 +2824,20 @@ local name, job
2824local _obj_0 = person 2824local _obj_0 = person
2825name, job = _obj_0.name, _obj_0.job 2825name, job = _obj_0.name, _obj_0.job
2826if name == nil then 2826if name == nil then
2827 name = "nameless" 2827 name = "namenlos"
2828end 2828end
2829if job == nil then 2829if job == nil then
2830 job = "jobless" 2830 job = "arbeitlos"
2831end 2831end
2832local two, four 2832local two, four
2833local _obj_0 = items 2833local _obj_0 = items
2834two, four = _obj_0[2], _obj_0[4] 2834two, four = _obj_0[2], _obj_0[4]
2835local orders = { 2835local orders = {
2836 "first", 2836 "erster",
2837 "second", 2837 "zweiter",
2838 "third", 2838 "dritter",
2839 "fourth", 2839 "vierter",
2840 "last" 2840 "letzter"
2841} 2841}
2842local first, bulk, last = orders[1], (function() 2842local first, bulk, last = orders[1], (function()
2843 local _accum_0 = { } 2843 local _accum_0 = { }
@@ -2887,12 +2887,12 @@ local _obj_0 = orders
2887first, last = _obj_0[1], _obj_0[#_obj_0] 2887first, last = _obj_0[1], _obj_0[#_obj_0]
2888local tuples = { 2888local tuples = {
2889 { 2889 {
2890 "hello", 2890 "hallo",
2891 "world" 2891 "Welt"
2892 }, 2892 },
2893 { 2893 {
2894 "egg", 2894 "Ei",
2895 "head" 2895 "Kopf"
2896 } 2896 }
2897} 2897}
2898for _index_0 = 1, #tuples do 2898for _index_0 = 1, #tuples do
@@ -2964,16 +2964,16 @@ do
2964end 2964end
2965local inventory = { 2965local inventory = {
2966 equipment = { 2966 equipment = {
2967 "sword", 2967 "Schwert",
2968 "shield" 2968 "Schild"
2969 }, 2969 },
2970 items = { 2970 items = {
2971 { 2971 {
2972 name = "potion", 2972 name = "Trank",
2973 count = 10 2973 count = 10
2974 }, 2974 },
2975 { 2975 {
2976 name = "bread", 2976 name = "Brot",
2977 count = 3 2977 count = 3
2978 } 2978 }
2979 } 2979 }
@@ -3031,7 +3031,7 @@ local apple = setmetatable({
3031if (getmetatable(apple) ~= nil) then 3031if (getmetatable(apple) ~= nil) then
3032 p(apple.size, apple.color, getmetatable(apple).__index) 3032 p(apple.size, apple.color, getmetatable(apple).__index)
3033end 3033end
3034local _u1f31b = "月之脚本" 3034local _u1f31b = "Skript des Mondes"
3035_module_0["🌛"] = _u1f31b 3035_module_0["🌛"] = _u1f31b
3036return _module_0 3036return _module_0
3037local _module_0 = { } 3037local _module_0 = { }
@@ -3042,16 +3042,16 @@ do
3042end 3042end
3043local inventory = { 3043local inventory = {
3044 equipment = { 3044 equipment = {
3045 "sword", 3045 "Schwert",
3046 "shield" 3046 "Schild"
3047 }, 3047 },
3048 items = { 3048 items = {
3049 { 3049 {
3050 name = "potion", 3050 name = "Trank",
3051 count = 10 3051 count = 10
3052 }, 3052 },
3053 { 3053 {
3054 name = "bread", 3054 name = "Brot",
3055 count = 3 3055 count = 3
3056 } 3056 }
3057 } 3057 }
@@ -3109,27 +3109,27 @@ local apple = setmetatable({
3109if (getmetatable(apple) ~= nil) then 3109if (getmetatable(apple) ~= nil) then
3110 p(apple.size, apple.color, getmetatable(apple).__index) 3110 p(apple.size, apple.color, getmetatable(apple).__index)
3111end 3111end
3112local _u1f31b = "月之脚本" 3112local _u1f31b = "Skript des Mondes"
3113_module_0["🌛"] = _u1f31b 3113_module_0["🌛"] = _u1f31b
3114return _module_0 3114return _module_0
3115local have_coins = false 3115local have_coins = false
3116if have_coins then 3116if have_coins then
3117 print("Got coins") 3117 print("Münzen erhalten")
3118else 3118else
3119 print("No coins") 3119 print("Keine Münzen")
3120end 3120end
3121local have_coins = false 3121local have_coins = false
3122if have_coins then 3122if have_coins then
3123 print("Got coins") 3123 print("Münzen erhalten")
3124else 3124else
3125 print("No coins") 3125 print("Keine Münzen")
3126end 3126end
3127local have_coins = false 3127local have_coins = false
3128print((function() 3128print((function()
3129 if have_coins then 3129 if have_coins then
3130 return "Got coins" 3130 return "Münzen erhalten"
3131 else 3131 else
3132 return "No coins" 3132 return "Keine Münzen"
3133 end 3133 end
3134end)()) 3134end)())
3135local is_tall 3135local is_tall
@@ -3142,20 +3142,20 @@ is_tall = function(name)
3142end 3142end
3143local message 3143local message
3144if is_tall("Rob") then 3144if is_tall("Rob") then
3145 message = "I am very tall" 3145 message = "Ich bin sehr groß"
3146else 3146else
3147 message = "I am not so tall" 3147 message = "Ich bin nicht so groß"
3148end 3148end
3149print(message) 3149print(message)
3150if not (os.date("%A") == "Monday") then 3150if not (os.date("%A") == "Monday") then
3151 print("it is not Monday!") 3151 print("Es ist nicht Montag!")
3152end 3152end
3153if not (math.random() > 0.1) then 3153if not (math.random() > 0.1) then
3154 print("You're lucky!") 3154 print("You're lucky!")
3155end 3155end
3156local a = 5 3156local a = 5
3157if (1 == a or 3 == a or 5 == a or 7 == a) then 3157if (1 == a or 3 == a or 5 == a or 7 == a) then
3158 print("checking equality with discrete values") 3158 print("Gleichheitsprüfung mit diskreten Werten")
3159end 3159end
3160if (function() 3160if (function()
3161 local _check_0 = list 3161 local _check_0 = list
@@ -3166,29 +3166,26 @@ if (function()
3166 end 3166 end
3167 return false 3167 return false
3168end)() then 3168end)() then
3169 print("checking if `a` is in a list") 3169 print("Prüfen, ob `a` in einer Liste ist")
3170end
3171if not (math.random() > 0.1) then
3172 print("You're lucky!")
3173end 3170end
3174local have_coins = false 3171local have_coins = false
3175if have_coins then 3172if have_coins then
3176 print("Got coins") 3173 print("Münzen erhalten")
3177else 3174else
3178 print("No coins") 3175 print("Keine Münzen")
3179end 3176end
3180local have_coins = false 3177local have_coins = false
3181if have_coins then 3178if have_coins then
3182 print("Got coins") 3179 print("Münzen erhalten")
3183else 3180else
3184 print("No coins") 3181 print("Keine Münzen")
3185end 3182end
3186local have_coins = false 3183local have_coins = false
3187print((function() 3184print((function()
3188 if have_coins then 3185 if have_coins then
3189 return "Got coins" 3186 return "Münzen erhalten"
3190 else 3187 else
3191 return "No coins" 3188 return "Keine Münzen"
3192 end 3189 end
3193end)()) 3190end)())
3194local is_tall 3191local is_tall
@@ -3201,20 +3198,20 @@ is_tall = function(name)
3201end 3198end
3202local message 3199local message
3203if is_tall("Rob") then 3200if is_tall("Rob") then
3204 message = "I am very tall" 3201 message = "Ich bin sehr groß"
3205else 3202else
3206 message = "I am not so tall" 3203 message = "Ich bin nicht so groß"
3207end 3204end
3208print(message) 3205print(message)
3209if not (os.date("%A") == "Monday") then 3206if not (os.date("%A") == "Monday") then
3210 print("it is not Monday!") 3207 print("Es ist nicht Montag!")
3211end 3208end
3212if not (math.random() > 0.1) then 3209if not (math.random() > 0.1) then
3213 print("You're lucky!") 3210 print("You're lucky!")
3214end 3211end
3215local a = 5 3212local a = 5
3216if (1 == a or 3 == a or 5 == a or 7 == a) then 3213if (1 == a or 3 == a or 5 == a or 7 == a) then
3217 print("checking equality with discrete values") 3214 print("Gleichheitsprüfung mit diskreten Werten")
3218end 3215end
3219if (function() 3216if (function()
3220 local _check_0 = list 3217 local _check_0 = list
@@ -3225,10 +3222,7 @@ if (function()
3225 end 3222 end
3226 return false 3223 return false
3227end)() then 3224end)() then
3228 print("checking if `a` is in a list") 3225 print("Prüfen, ob `a` in einer Liste ist")
3229end
3230if not (math.random() > 0.1) then
3231 print("You're lucky!")
3232end 3226end
3233for i = 10, 20 do 3227for i = 10, 20 do
3234 print(i) 3228 print(i)
@@ -3420,11 +3414,11 @@ end
3420odds = _accum_0 3414odds = _accum_0
3421local name = "Dan" 3415local name = "Dan"
3422if "Robert" == name then 3416if "Robert" == name then
3423 print("You are Robert") 3417 print("Du bist Robert")
3424elseif "Dan" == name or "Daniel" == name then 3418elseif "Dan" == name or "Daniel" == name then
3425 print("Your name, it's Dan") 3419 print("Dein Name ist Dan")
3426else 3420else
3427 print("I don't know about you with name " .. tostring(name)) 3421 print("Ich kenne dich nicht mit dem Namen " .. tostring(name))
3428end 3422end
3429local b = 1 3423local b = 1
3430local next_number 3424local next_number
@@ -3433,30 +3427,30 @@ if 1 == b then
3433elseif 2 == b then 3427elseif 2 == b then
3434 next_number = 3 3428 next_number = 3
3435else 3429else
3436 next_number = error("can't count that high!") 3430 next_number = error("so hoch kann ich nicht hlen!")
3437end 3431end
3438local msg 3432local msg
3439local _exp_0 = math.random(1, 5) 3433local _exp_0 = math.random(1, 5)
3440if 1 == _exp_0 then 3434if 1 == _exp_0 then
3441 msg = "you are lucky" 3435 msg = "Du hast Glück"
3442elseif 2 == _exp_0 then 3436elseif 2 == _exp_0 then
3443 msg = "you are almost lucky" 3437 msg = "Du hast fast Glück"
3444else 3438else
3445 msg = "not so lucky" 3439 msg = "nicht so viel Glück"
3446end 3440end
3447do 3441do
3448 local _exp_0 = math.random(1, 5) 3442 local _exp_0 = math.random(1, 5)
3449 if 1 == _exp_0 then 3443 if 1 == _exp_0 then
3450 print("you are lucky") 3444 print("Du hast Glück")
3451 else 3445 else
3452 print("not so lucky") 3446 print("nicht so viel Glück")
3453 end 3447 end
3454end 3448end
3455local _exp_0 = math.random(1, 5) 3449local _exp_0 = math.random(1, 5)
3456if 1 == _exp_0 then 3450if 1 == _exp_0 then
3457 print("you are lucky") 3451 print("Du hast Glück")
3458else 3452else
3459 print("not so lucky") 3453 print("nicht so viel Glück")
3460end 3454end
3461local items = { 3455local items = {
3462 { 3456 {
@@ -3486,7 +3480,7 @@ for _index_0 = 1, #items do
3486 local width = item.width 3480 local width = item.width
3487 local height = item.height 3481 local height = item.height
3488 if width ~= nil and height ~= nil then 3482 if width ~= nil and height ~= nil then
3489 print("size " .. tostring(width) .. ", " .. tostring(height)) 3483 print("Größe " .. tostring(width) .. ", " .. tostring(height))
3490 end 3484 end
3491 end 3485 end
3492 end 3486 end
@@ -3563,7 +3557,7 @@ if _tab_0 then
3563 local result = _exp_0.result 3557 local result = _exp_0.result
3564 if true == _exp_0.success and result ~= nil then 3558 if true == _exp_0.success and result ~= nil then
3565 _match_0 = true 3559 _match_0 = true
3566 print("success", result) 3560 print("Erfolg", result)
3567 end 3561 end
3568end 3562end
3569if not _match_0 then 3563if not _match_0 then
@@ -3571,11 +3565,11 @@ if not _match_0 then
3571 if _tab_0 then 3565 if _tab_0 then
3572 if false == _exp_0.success then 3566 if false == _exp_0.success then
3573 _match_1 = true 3567 _match_1 = true
3574 print("failed", result) 3568 print("fehlgeschlagen", result)
3575 end 3569 end
3576 end 3570 end
3577 if not _match_1 then 3571 if not _match_1 then
3578 print("invalid") 3572 print("unltig")
3579 end 3573 end
3580end 3574end
3581local _exp_0 = tb 3575local _exp_0 = tb
@@ -3600,7 +3594,7 @@ if _tab_0 then
3600 end 3594 end
3601 if "success" == _val_0 and content ~= nil then 3595 if "success" == _val_0 and content ~= nil then
3602 _match_0 = true 3596 _match_0 = true
3603 print("success", content) 3597 print("Erfolg", content)
3604 end 3598 end
3605end 3599end
3606if not _match_0 then 3600if not _match_0 then
@@ -3623,11 +3617,11 @@ if not _match_0 then
3623 end 3617 end
3624 if "error" == _val_0 and content ~= nil then 3618 if "error" == _val_0 and content ~= nil then
3625 _match_1 = true 3619 _match_1 = true
3626 print("failed", content) 3620 print("fehlgeschlagen", content)
3627 end 3621 end
3628 end 3622 end
3629 if not _match_1 then 3623 if not _match_1 then
3630 print("invalid") 3624 print("unltig")
3631 end 3625 end
3632end 3626end
3633local _exp_0 = tb 3627local _exp_0 = tb
@@ -3678,7 +3672,7 @@ if _tab_0 then
3678 end 3672 end
3679 end 3673 end
3680 if 1 == _val_0 and 2 == _val_1 and 3 == _val_2 and 4 == _val_3 and 5 == _val_4 and 6 == _val_5 and fourth ~= nil then 3674 if 1 == _val_0 and 2 == _val_1 and 3 == _val_2 and 4 == _val_3 and 5 == _val_4 and 6 == _val_5 and fourth ~= nil then
3681 print("matched", fourth) 3675 print("getroffen", fourth)
3682 end 3676 end
3683end 3677end
3684local segments = { 3678local segments = {
@@ -3705,18 +3699,18 @@ if _tab_0 then
3705 local resource = segments[#segments - 1] 3699 local resource = segments[#segments - 1]
3706 local action = segments[#segments] 3700 local action = segments[#segments]
3707 if resource ~= nil and action ~= nil then 3701 if resource ~= nil and action ~= nil then
3708 print("Group:", groups) 3702 print("Gruppe:", groups)
3709 print("Resource:", resource) 3703 print("Ressource:", resource)
3710 print("Action:", action) 3704 print("Aktion:", action)
3711 end 3705 end
3712end 3706end
3713local name = "Dan" 3707local name = "Dan"
3714if "Robert" == name then 3708if "Robert" == name then
3715 print("You are Robert") 3709 print("Du bist Robert")
3716elseif "Dan" == name or "Daniel" == name then 3710elseif "Dan" == name or "Daniel" == name then
3717 print("Your name, it's Dan") 3711 print("Dein Name ist Dan")
3718else 3712else
3719 print("I don't know about you with name " .. tostring(name)) 3713 print("Ich kenne dich nicht mit dem Namen " .. tostring(name))
3720end 3714end
3721local b = 1 3715local b = 1
3722local next_number 3716local next_number
@@ -3725,30 +3719,30 @@ if 1 == b then
3725elseif 2 == b then 3719elseif 2 == b then
3726 next_number = 3 3720 next_number = 3
3727else 3721else
3728 next_number = error("can't count that high!") 3722 next_number = error("so hoch kann ich nicht hlen!")
3729end 3723end
3730local msg 3724local msg
3731local _exp_0 = math.random(1, 5) 3725local _exp_0 = math.random(1, 5)
3732if 1 == _exp_0 then 3726if 1 == _exp_0 then
3733 msg = "you are lucky" 3727 msg = "Du hast Glück"
3734elseif 2 == _exp_0 then 3728elseif 2 == _exp_0 then
3735 msg = "you are almost lucky" 3729 msg = "Du hast fast Glück"
3736else 3730else
3737 msg = "not so lucky" 3731 msg = "nicht so viel Glück"
3738end 3732end
3739do 3733do
3740 local _exp_0 = math.random(1, 5) 3734 local _exp_0 = math.random(1, 5)
3741 if 1 == _exp_0 then 3735 if 1 == _exp_0 then
3742 print("you are lucky") 3736 print("Du hast Glück")
3743 else 3737 else
3744 print("not so lucky") 3738 print("nicht so viel Glück")
3745 end 3739 end
3746end 3740end
3747local _exp_0 = math.random(1, 5) 3741local _exp_0 = math.random(1, 5)
3748if 1 == _exp_0 then 3742if 1 == _exp_0 then
3749 print("you are lucky") 3743 print("Du hast Glück")
3750else 3744else
3751 print("not so lucky") 3745 print("nicht so viel Glück")
3752end 3746end
3753local items = { 3747local items = {
3754 { 3748 {
@@ -3778,7 +3772,7 @@ for _index_0 = 1, #items do
3778 local width = item.width 3772 local width = item.width
3779 local height = item.height 3773 local height = item.height
3780 if width ~= nil and height ~= nil then 3774 if width ~= nil and height ~= nil then
3781 print("size " .. tostring(width) .. ", " .. tostring(height)) 3775 print("Größe " .. tostring(width) .. ", " .. tostring(height))
3782 end 3776 end
3783 end 3777 end
3784 end 3778 end
@@ -3855,7 +3849,7 @@ if _tab_0 then
3855 local result = _exp_0.result 3849 local result = _exp_0.result
3856 if true == _exp_0.success and result ~= nil then 3850 if true == _exp_0.success and result ~= nil then
3857 _match_0 = true 3851 _match_0 = true
3858 print("success", result) 3852 print("Erfolg", result)
3859 end 3853 end
3860end 3854end
3861if not _match_0 then 3855if not _match_0 then
@@ -3863,11 +3857,11 @@ if not _match_0 then
3863 if _tab_0 then 3857 if _tab_0 then
3864 if false == _exp_0.success then 3858 if false == _exp_0.success then
3865 _match_1 = true 3859 _match_1 = true
3866 print("failed", result) 3860 print("fehlgeschlagen", result)
3867 end 3861 end
3868 end 3862 end
3869 if not _match_1 then 3863 if not _match_1 then
3870 print("invalid") 3864 print("unltig")
3871 end 3865 end
3872end 3866end
3873local _exp_0 = tb 3867local _exp_0 = tb
@@ -3892,7 +3886,7 @@ if _tab_0 then
3892 end 3886 end
3893 if "success" == _val_0 and content ~= nil then 3887 if "success" == _val_0 and content ~= nil then
3894 _match_0 = true 3888 _match_0 = true
3895 print("success", content) 3889 print("Erfolg", content)
3896 end 3890 end
3897end 3891end
3898if not _match_0 then 3892if not _match_0 then
@@ -3915,11 +3909,11 @@ if not _match_0 then
3915 end 3909 end
3916 if "error" == _val_0 and content ~= nil then 3910 if "error" == _val_0 and content ~= nil then
3917 _match_1 = true 3911 _match_1 = true
3918 print("failed", content) 3912 print("fehlgeschlagen", content)
3919 end 3913 end
3920 end 3914 end
3921 if not _match_1 then 3915 if not _match_1 then
3922 print("invalid") 3916 print("unltig")
3923 end 3917 end
3924end 3918end
3925local _exp_0 = tb 3919local _exp_0 = tb
@@ -3970,7 +3964,7 @@ if _tab_0 then
3970 end 3964 end
3971 end 3965 end
3972 if 1 == _val_0 and 2 == _val_1 and 3 == _val_2 and 4 == _val_3 and 5 == _val_4 and 6 == _val_5 and fourth ~= nil then 3966 if 1 == _val_0 and 2 == _val_1 and 3 == _val_2 and 4 == _val_3 and 5 == _val_4 and 6 == _val_5 and fourth ~= nil then
3973 print("matched", fourth) 3967 print("getroffen", fourth)
3974 end 3968 end
3975end 3969end
3976local segments = { 3970local segments = {
@@ -3997,9 +3991,9 @@ if _tab_0 then
3997 local resource = segments[#segments - 1] 3991 local resource = segments[#segments - 1]
3998 local action = segments[#segments] 3992 local action = segments[#segments]
3999 if resource ~= nil and action ~= nil then 3993 if resource ~= nil and action ~= nil then
4000 print("Group:", groups) 3994 print("Gruppe:", groups)
4001 print("Resource:", resource) 3995 print("Ressource:", resource)
4002 print("Action:", action) 3996 print("Aktion:", action)
4003 end 3997 end
4004end 3998end
4005local i = 10 3999local i = 10
@@ -4047,12 +4041,12 @@ until i == 0
4047local my_object = { 4041local my_object = {
4048 value = 1000, 4042 value = 1000,
4049 write = function(self) 4043 write = function(self)
4050 return print("the value:", self.value) 4044 return print("der Wert:", self.value)
4051 end 4045 end
4052} 4046}
4053local run_callback 4047local run_callback
4054run_callback = function(func) 4048run_callback = function(func)
4055 print("running callback...") 4049 print("Callback wird ausgeführt...")
4056 return func() 4050 return func()
4057end 4051end
4058run_callback(my_object.write) 4052run_callback(my_object.write)
@@ -4066,12 +4060,12 @@ end)())
4066local my_object = { 4060local my_object = {
4067 value = 1000, 4061 value = 1000,
4068 write = function(self) 4062 write = function(self)
4069 return print("the value:", self.value) 4063 return print("der Wert:", self.value)
4070 end 4064 end
4071} 4065}
4072local run_callback 4066local run_callback
4073run_callback = function(func) 4067run_callback = function(func)
4074 print("running callback...") 4068 print("Callback wird ausgeführt...")
4075 return func() 4069 return func()
4076end 4070end
4077run_callback(my_object.write) 4071run_callback(my_object.write)
@@ -4083,7 +4077,7 @@ run_callback((function()
4083 end 4077 end
4084end)()) 4078end)())
4085f(function(x) 4079f(function(x)
4086 return print("hello" .. x) 4080 return print("hallo" .. x)
4087end) 4081end)
4088f(function(self) 4082f(function(self)
4089 return print(self.value) 4083 return print(self.value)
@@ -4097,7 +4091,7 @@ end, {
4097}) 4091})
4098local result, msg 4092local result, msg
4099do 4093do
4100 result, msg = readAsync("filename.txt", function(data) 4094 result, msg = readAsync("dateiname.txt", function(data)
4101 print(data) 4095 print(data)
4102 return processAsync(data, function(info) 4096 return processAsync(data, function(info)
4103 return check(info) 4097 return check(info)
@@ -4106,7 +4100,7 @@ do
4106end 4100end
4107print(result, msg) 4101print(result, msg)
4108f(function(x) 4102f(function(x)
4109 return print("hello" .. x) 4103 return print("hallo" .. x)
4110end) 4104end)
4111f(function(self) 4105f(function(self)
4112 return print(self.value) 4106 return print(self.value)
@@ -4120,7 +4114,7 @@ end, {
4120}) 4114})
4121local result, msg 4115local result, msg
4122do 4116do
4123 result, msg = readAsync("filename.txt", function(data) 4117 result, msg = readAsync("dateiname.txt", function(data)
4124 print(data) 4118 print(data)
4125 return processAsync(data, function(info) 4119 return processAsync(data, function(info)
4126 return check(info) 4120 return check(info)
@@ -4133,18 +4127,18 @@ my_function = function() end
4133my_function() 4127my_function()
4134local func_a 4128local func_a
4135func_a = function() 4129func_a = function()
4136 return print("hello world") 4130 return print("Hallo Welt")
4137end 4131end
4138local func_b 4132local func_b
4139func_b = function() 4133func_b = function()
4140 local value = 100 4134 local value = 100
4141 return print("The value:", value) 4135 return print("Der Wert:", value)
4142end 4136end
4143func_a() 4137func_a()
4144func_b() 4138func_b()
4145local sum 4139local sum
4146sum = function(x, y) 4140sum = function(x, y)
4147 return print("sum", x + y) 4141 return print("Summe", x + y)
4148end 4142end
4149sum(10, 20) 4143sum(10, 20)
4150print(sum(10, 20)) 4144print(sum(10, 20))
@@ -4154,7 +4148,7 @@ local sum
4154sum = function(x, y) 4148sum = function(x, y)
4155 return x + y 4149 return x + y
4156end 4150end
4157print("The sum is ", sum(10, 20)) 4151print("Die Summe ist ", sum(10, 20))
4158local sum 4152local sum
4159sum = function(x, y) 4153sum = function(x, y)
4160 return x + y 4154 return x + y
@@ -4171,13 +4165,13 @@ end
4171local my_function 4165local my_function
4172my_function = function(name, height) 4166my_function = function(name, height)
4173 if name == nil then 4167 if name == nil then
4174 name = "something" 4168 name = "etwas"
4175 end 4169 end
4176 if height == nil then 4170 if height == nil then
4177 height = 100 4171 height = 100
4178 end 4172 end
4179 print("Hello I am", name) 4173 print("Hallo, ich bin", name)
4180 return print("My height is", height) 4174 return print("Meine Größe ist", height)
4181end 4175end
4182local some_args 4176local some_args
4183some_args = function(x, y) 4177some_args = function(x, y)
@@ -4193,8 +4187,8 @@ local a = x - 10
4193local b = x - 10 4187local b = x - 10
4194local c = x(-y) 4188local c = x(-y)
4195local d = x - z 4189local d = x - z
4196local x = func("hello") + 100 4190local x = func("hallo") + 100
4197local y = func("hello" + 100) 4191local y = func("hallo" + 100)
4198my_func(5, 4, 3, 8, 9, 10) 4192my_func(5, 4, 3, 8, 9, 10)
4199cool_func(1, 2, 3, 4, 5, 6, 7, 8) 4193cool_func(1, 2, 3, 4, 5, 6, 7, 8)
4200my_func(5, 6, 7, 6, another_func(6, 7, 8, 9, 1, 2), 5, 4) 4194my_func(5, 6, 7, 6, another_func(6, 7, 8, 9, 1, 2), 5, 4)
@@ -4214,13 +4208,13 @@ local y = {
4214 6, 4208 6,
4215 7 4209 7
4216} 4210}
4217if func(1, 2, 3, "hello", "world") then 4211if func(1, 2, 3, "hallo", "Welt") then
4218 print("hello") 4212 print("hallo")
4219 print("I am inside if") 4213 print("Ich bin innerhalb der if-Bedingung")
4220end 4214end
4221if func(1, 2, 3, "hello", "world") then 4215if func(1, 2, 3, "hallo", "Welt") then
4222 print("hello") 4216 print("hallo")
4223 print("I am inside if") 4217 print("Ich bin innerhalb der if-Bedingung")
4224end 4218end
4225local f1 4219local f1
4226f1 = function(_arg_0) 4220f1 = function(_arg_0)
@@ -4288,8 +4282,8 @@ f = function(...)
4288 n = select("#", ...), 4282 n = select("#", ...),
4289 ... 4283 ...
4290 } 4284 }
4291 print("argument count:", t.n) 4285 print("Anzahl der Argumente:", t.n)
4292 print("table length:", #t) 4286 print("Tabellenlänge:", #t)
4293 for i = 1, t.n do 4287 for i = 1, t.n do
4294 print(t[i]) 4288 print(t[i])
4295 end 4289 end
@@ -4317,18 +4311,18 @@ my_function = function() end
4317my_function() 4311my_function()
4318local func_a 4312local func_a
4319func_a = function() 4313func_a = function()
4320 return print("hello world") 4314 return print("Hallo Welt")
4321end 4315end
4322local func_b 4316local func_b
4323func_b = function() 4317func_b = function()
4324 local value = 100 4318 local value = 100
4325 return print("The value:", value) 4319 return print("Der Wert:", value)
4326end 4320end
4327func_a() 4321func_a()
4328func_b() 4322func_b()
4329local sum 4323local sum
4330sum = function(x, y) 4324sum = function(x, y)
4331 return print("sum", x + y) 4325 return print("Summe", x + y)
4332end 4326end
4333sum(10, 20) 4327sum(10, 20)
4334print(sum(10, 20)) 4328print(sum(10, 20))
@@ -4338,7 +4332,7 @@ local sum
4338sum = function(x, y) 4332sum = function(x, y)
4339 return x + y 4333 return x + y
4340end 4334end
4341print("The sum is ", sum(10, 20)) 4335print("Die Summe ist ", sum(10, 20))
4342local sum 4336local sum
4343sum = function(x, y) 4337sum = function(x, y)
4344 return x + y 4338 return x + y
@@ -4355,13 +4349,13 @@ end
4355local my_function 4349local my_function
4356my_function = function(name, height) 4350my_function = function(name, height)
4357 if name == nil then 4351 if name == nil then
4358 name = "something" 4352 name = "etwas"
4359 end 4353 end
4360 if height == nil then 4354 if height == nil then
4361 height = 100 4355 height = 100
4362 end 4356 end
4363 print("Hello I am", name) 4357 print("Hallo, ich bin", name)
4364 return print("My height is", height) 4358 return print("Meine Größe ist", height)
4365end 4359end
4366local some_args 4360local some_args
4367some_args = function(x, y) 4361some_args = function(x, y)
@@ -4377,8 +4371,8 @@ local a = x - 10
4377local b = x - 10 4371local b = x - 10
4378local c = x(-y) 4372local c = x(-y)
4379local d = x - z 4373local d = x - z
4380local x = func("hello") + 100 4374local x = func("hallo") + 100
4381local y = func("hello" + 100) 4375local y = func("hallo" + 100)
4382my_func(5, 4, 3, 8, 9, 10) 4376my_func(5, 4, 3, 8, 9, 10)
4383cool_func(1, 2, 3, 4, 5, 6, 7, 8) 4377cool_func(1, 2, 3, 4, 5, 6, 7, 8)
4384my_func(5, 6, 7, 6, another_func(6, 7, 8, 9, 1, 2), 5, 4) 4378my_func(5, 6, 7, 6, another_func(6, 7, 8, 9, 1, 2), 5, 4)
@@ -4398,13 +4392,13 @@ local y = {
4398 6, 4392 6,
4399 7 4393 7
4400} 4394}
4401if func(1, 2, 3, "hello", "world") then 4395if func(1, 2, 3, "hallo", "Welt") then
4402 print("hello") 4396 print("hallo")
4403 print("I am inside if") 4397 print("Ich bin innerhalb der if-Bedingung")
4404end 4398end
4405if func(1, 2, 3, "hello", "world") then 4399if func(1, 2, 3, "hallo", "Welt") then
4406 print("hello") 4400 print("hallo")
4407 print("I am inside if") 4401 print("Ich bin innerhalb der if-Bedingung")
4408end 4402end
4409local f1 4403local f1
4410f1 = function(_arg_0) 4404f1 = function(_arg_0)
@@ -4472,8 +4466,8 @@ f = function(...)
4472 n = select("#", ...), 4466 n = select("#", ...),
4473 ... 4467 ...
4474 } 4468 }
4475 print("argument count:", t.n) 4469 print("Anzahl der Argumente:", t.n)
4476 print("table length:", #t) 4470 print("Tabellenlänge:", #t)
4477 for i = 1, t.n do 4471 for i = 1, t.n do
4478 print(t[i]) 4472 print(t[i])
4479 end 4473 end
@@ -4519,7 +4513,7 @@ func(3000, "192.168.1.1")
4519local a <const> = 123 4513local a <const> = 123
4520local _ <close> = setmetatable({ }, { 4514local _ <close> = setmetatable({ }, {
4521 __close = function() 4515 __close = function()
4522 return print("Out of scope.") 4516 return print("Außerhalb des Gültigkeitsbereichs.")
4523 end 4517 end
4524}) 4518})
4525local a, b, c, d 4519local a, b, c, d
@@ -4529,7 +4523,7 @@ Constant = 123
4529local a <const> = 123 4523local a <const> = 123
4530local _ <close> = setmetatable({ }, { 4524local _ <close> = setmetatable({ }, {
4531 __close = function() 4525 __close = function()
4532 return print("Out of scope.") 4526 return print("Außerhalb des Gültigkeitsbereichs.")
4533 end 4527 end
4534}) 4528})
4535local a, b, c, d 4529local a, b, c, d
@@ -4567,7 +4561,7 @@ print((function()
4567 end 4561 end
4568end)()) 4562end)())
4569local tab = { } 4563local tab = { }
4570tab[#tab + 1] = "Value" 4564tab[#tab + 1] = "Wert"
4571local tbA = { 4565local tbA = {
4572 1, 4566 1,
4573 2, 4567 2,
@@ -4584,13 +4578,13 @@ for _index_0 = 1, #tbB do
4584 tbA[_len_0], _len_0 = _elm_0, _len_0 + 1 4578 tbA[_len_0], _len_0 = _elm_0, _len_0 + 1
4585end 4579end
4586local parts = { 4580local parts = {
4587 "shoulders", 4581 "Schultern",
4588 "knees" 4582 "Knie"
4589} 4583}
4590local lyrics 4584local lyrics
4591do 4585do
4592 local _tab_0 = { 4586 local _tab_0 = {
4593 "head" 4587 "Kopf"
4594 } 4588 }
4595 local _idx_0 = 1 4589 local _idx_0 = 1
4596 for _key_0, _value_0 in pairs(parts) do 4590 for _key_0, _value_0 in pairs(parts) do
@@ -4601,8 +4595,8 @@ do
4601 _tab_0[_key_0] = _value_0 4595 _tab_0[_key_0] = _value_0
4602 end 4596 end
4603 end 4597 end
4604 _tab_0[#_tab_0 + 1] = "and" 4598 _tab_0[#_tab_0 + 1] = "und"
4605 _tab_0[#_tab_0 + 1] = "toes" 4599 _tab_0[#_tab_0 + 1] = "Zehen"
4606 lyrics = _tab_0 4600 lyrics = _tab_0
4607end 4601end
4608local copy 4602local copy
@@ -4688,7 +4682,7 @@ local d = a + b + c
4688print(d.value) 4682print(d.value)
4689local _ <close> = setmetatable({ }, { 4683local _ <close> = setmetatable({ }, {
4690 __close = function() 4684 __close = function()
4691 return print("out of scope") 4685 return print("Außerhalb des Gültigkeitsbereichs")
4692 end 4686 end
4693}) 4687})
4694local tb = setmetatable({ }, { 4688local tb = setmetatable({ }, {
@@ -4698,7 +4692,7 @@ getmetatable(tb).__index = getmetatable(tb)
4698print(tb.value) 4692print(tb.value)
4699setmetatable(tb, { 4693setmetatable(tb, {
4700 __index = { 4694 __index = {
4701 item = "hello" 4695 item = "hallo"
4702 } 4696 }
4703}) 4697})
4704print(tb.item) 4698print(tb.item)
@@ -4860,7 +4854,7 @@ print((function()
4860 end 4854 end
4861end)()) 4855end)())
4862local tab = { } 4856local tab = { }
4863tab[#tab + 1] = "Value" 4857tab[#tab + 1] = "Wert"
4864local tbA = { 4858local tbA = {
4865 1, 4859 1,
4866 2, 4860 2,
@@ -4877,13 +4871,13 @@ for _index_0 = 1, #tbB do
4877 tbA[_len_0], _len_0 = _elm_0, _len_0 + 1 4871 tbA[_len_0], _len_0 = _elm_0, _len_0 + 1
4878end 4872end
4879local parts = { 4873local parts = {
4880 "shoulders", 4874 "Schultern",
4881 "knees" 4875 "Knie"
4882} 4876}
4883local lyrics 4877local lyrics
4884do 4878do
4885 local _tab_0 = { 4879 local _tab_0 = {
4886 "head" 4880 "Kopf"
4887 } 4881 }
4888 local _idx_0 = 1 4882 local _idx_0 = 1
4889 for _key_0, _value_0 in pairs(parts) do 4883 for _key_0, _value_0 in pairs(parts) do
@@ -4894,8 +4888,8 @@ do
4894 _tab_0[_key_0] = _value_0 4888 _tab_0[_key_0] = _value_0
4895 end 4889 end
4896 end 4890 end
4897 _tab_0[#_tab_0 + 1] = "and" 4891 _tab_0[#_tab_0 + 1] = "und"
4898 _tab_0[#_tab_0 + 1] = "toes" 4892 _tab_0[#_tab_0 + 1] = "Zehen"
4899 lyrics = _tab_0 4893 lyrics = _tab_0
4900end 4894end
4901local copy 4895local copy
@@ -4981,7 +4975,7 @@ local d = a + b + c
4981print(d.value) 4975print(d.value)
4982local _ <close> = setmetatable({ }, { 4976local _ <close> = setmetatable({ }, {
4983 __close = function() 4977 __close = function()
4984 return print("out of scope") 4978 return print("Außerhalb des Gültigkeitsbereichs")
4985 end 4979 end
4986}) 4980})
4987local tb = setmetatable({ }, { 4981local tb = setmetatable({ }, {
@@ -4991,7 +4985,7 @@ getmetatable(tb).__index = getmetatable(tb)
4991print(tb.value) 4985print(tb.value)
4992setmetatable(tb, { 4986setmetatable(tb, {
4993 __index = { 4987 __index = {
4994 item = "hello" 4988 item = "hallo"
4995 } 4989 }
4996}) 4990})
4997print(tb.item) 4991print(tb.item)
@@ -5122,8 +5116,8 @@ local tb = {
5122 } 5116 }
5123 } 5117 }
5124} 5118}
5125local some_string = "Here is a string\n that has a line break in it." 5119local some_string = "Hier ist ein String\n mit einem Zeilenumbruch."
5126print("I am " .. tostring(math.random() * 100) .. "% sure.") 5120print("Ich bin mir zu " .. tostring(math.random() * 100) .. "% sicher.")
5127local integer = 1000000 5121local integer = 1000000
5128local hex = 0xEFBBBF 5122local hex = 0xEFBBBF
5129local binary = 19 5123local binary = 19
@@ -5134,8 +5128,8 @@ fn = function()
5134 return str 5128 return str
5135end 5129end
5136local str = "path: \"C:\\Program Files\\App\"\nnote: 'He said: \"" .. tostring(Hello) .. "!\"'" 5130local str = "path: \"C:\\Program Files\\App\"\nnote: 'He said: \"" .. tostring(Hello) .. "!\"'"
5137local some_string = "Here is a string\n that has a line break in it." 5131local some_string = "Hier ist ein String\n mit einem Zeilenumbruch."
5138print("I am " .. tostring(math.random() * 100) .. "% sure.") 5132print("Ich bin mir zu " .. tostring(math.random() * 100) .. "% sicher.")
5139local integer = 1000000 5133local integer = 1000000
5140local hex = 0xEFBBBF 5134local hex = 0xEFBBBF
5141local binary = 19 5135local binary = 19
diff --git a/spec/outputs/codes_from_doc_en.lua b/spec/outputs/codes_from_doc_en.lua
index 0b3670c..5320961 100644
--- a/spec/outputs/codes_from_doc_en.lua
+++ b/spec/outputs/codes_from_doc_en.lua
@@ -3031,7 +3031,7 @@ local apple = setmetatable({
3031if (getmetatable(apple) ~= nil) then 3031if (getmetatable(apple) ~= nil) then
3032 p(apple.size, apple.color, getmetatable(apple).__index) 3032 p(apple.size, apple.color, getmetatable(apple).__index)
3033end 3033end
3034local _u1f31b = "月之脚本" 3034local _u1f31b = "Script of Moon"
3035_module_0["🌛"] = _u1f31b 3035_module_0["🌛"] = _u1f31b
3036return _module_0 3036return _module_0
3037local _module_0 = { } 3037local _module_0 = { }
@@ -3109,7 +3109,7 @@ local apple = setmetatable({
3109if (getmetatable(apple) ~= nil) then 3109if (getmetatable(apple) ~= nil) then
3110 p(apple.size, apple.color, getmetatable(apple).__index) 3110 p(apple.size, apple.color, getmetatable(apple).__index)
3111end 3111end
3112local _u1f31b = "月之脚本" 3112local _u1f31b = "Script of Moon"
3113_module_0["🌛"] = _u1f31b 3113_module_0["🌛"] = _u1f31b
3114return _module_0 3114return _module_0
3115local have_coins = false 3115local have_coins = false
@@ -3168,9 +3168,6 @@ if (function()
3168end)() then 3168end)() then
3169 print("checking if `a` is in a list") 3169 print("checking if `a` is in a list")
3170end 3170end
3171if not (math.random() > 0.1) then
3172 print("You're lucky!")
3173end
3174local have_coins = false 3171local have_coins = false
3175if have_coins then 3172if have_coins then
3176 print("Got coins") 3173 print("Got coins")
@@ -3227,9 +3224,6 @@ if (function()
3227end)() then 3224end)() then
3228 print("checking if `a` is in a list") 3225 print("checking if `a` is in a list")
3229end 3226end
3230if not (math.random() > 0.1) then
3231 print("You're lucky!")
3232end
3233for i = 10, 20 do 3227for i = 10, 20 do
3234 print(i) 3228 print(i)
3235end 3229end
diff --git a/spec/outputs/codes_from_doc_id-id.lua b/spec/outputs/codes_from_doc_id-id.lua
index 0b3670c..e952434 100644
--- a/spec/outputs/codes_from_doc_id-id.lua
+++ b/spec/outputs/codes_from_doc_id-id.lua
@@ -83,17 +83,17 @@ do
83end 83end
84local funcA 84local funcA
85funcA = function() 85funcA = function()
86 return "fail to assign to the Yue macro defined variable" 86 return "gagal meng-assign ke variabel yang didefinisikan oleh macro Yue"
87end 87end
88do 88do
89local function funcB() end 89local function funcB() end
90end 90end
91local funcB 91local funcB
92funcB = function() 92funcB = function()
93 return "fail to assign to the Lua macro defined variable" 93 return "gagal meng-assign ke variabel yang didefinisikan oleh macro Lua"
94end 94end
95do 95do
96-- raw Lua codes insertion 96-- penyisipan kode Lua mentah
97if cond then 97if cond then
98 print("output") 98 print("output")
99end 99end
@@ -122,17 +122,17 @@ do
122end 122end
123local funcA 123local funcA
124funcA = function() 124funcA = function()
125 return "fail to assign to the Yue macro defined variable" 125 return "gagal meng-assign ke variabel yang didefinisikan oleh macro Yue"
126end 126end
127do 127do
128local function funcB() end 128local function funcB() end
129end 129end
130local funcB 130local funcB
131funcB = function() 131funcB = function()
132 return "fail to assign to the Lua macro defined variable" 132 return "gagal meng-assign ke variabel yang didefinisikan oleh macro Lua"
133end 133end
134do 134do
135-- raw Lua codes insertion 135-- penyisipan kode Lua mentah
136if cond then 136if cond then
137 print("output") 137 print("output")
138end 138end
@@ -2488,7 +2488,7 @@ local z = x
2488do 2488do
2489 local a = 1 2489 local a = 1
2490 local x, y, z 2490 local x, y, z
2491 print("forward declare all variables as locals") 2491 print("deklarasikan semua variabel sebagai local di awal")
2492 x = function() 2492 x = function()
2493 return 1 + y + z 2493 return 1 + y + z
2494 end 2494 end
@@ -2498,13 +2498,13 @@ end
2498do 2498do
2499 local X = 1 2499 local X = 1
2500 local B 2500 local B
2501 print("only forward declare upper case variables") 2501 print("hanya deklarasikan variabel huruf besar sebagai local di awal")
2502 local a = 1 2502 local a = 1
2503 B = 2 2503 B = 2
2504end 2504end
2505do 2505do
2506 a = 1 2506 a = 1
2507 print("declare all variables as globals") 2507 print("deklarasikan semua variabel sebagai global")
2508 x = function() 2508 x = function()
2509 return 1 + y + z 2509 return 1 + y + z
2510 end 2510 end
@@ -2512,7 +2512,7 @@ do
2512end 2512end
2513do 2513do
2514 X = 1 2514 X = 1
2515 print("only declare upper case variables as globals") 2515 print("hanya deklarasikan variabel huruf besar sebagai global")
2516 local a = 1 2516 local a = 1
2517 B = 2 2517 B = 2
2518 local Temp = "a local value" 2518 local Temp = "a local value"
@@ -2539,7 +2539,7 @@ local z = x
2539do 2539do
2540 local a = 1 2540 local a = 1
2541 local x, y, z 2541 local x, y, z
2542 print("forward declare all variables as locals") 2542 print("deklarasikan semua variabel sebagai local di awal")
2543 x = function() 2543 x = function()
2544 return 1 + y + z 2544 return 1 + y + z
2545 end 2545 end
@@ -2549,13 +2549,13 @@ end
2549do 2549do
2550 local X = 1 2550 local X = 1
2551 local B 2551 local B
2552 print("only forward declare upper case variables") 2552 print("hanya deklarasikan variabel huruf besar sebagai local di awal")
2553 local a = 1 2553 local a = 1
2554 B = 2 2554 B = 2
2555end 2555end
2556do 2556do
2557 a = 1 2557 a = 1
2558 print("declare all variables as globals") 2558 print("deklarasikan semua variabel sebagai global")
2559 x = function() 2559 x = function()
2560 return 1 + y + z 2560 return 1 + y + z
2561 end 2561 end
@@ -2563,7 +2563,7 @@ do
2563end 2563end
2564do 2564do
2565 X = 1 2565 X = 1
2566 print("only declare upper case variables as globals") 2566 print("hanya deklarasikan variabel huruf besar sebagai global")
2567 local a = 1 2567 local a = 1
2568 B = 2 2568 B = 2
2569 local Temp = "a local value" 2569 local Temp = "a local value"
@@ -3031,7 +3031,7 @@ local apple = setmetatable({
3031if (getmetatable(apple) ~= nil) then 3031if (getmetatable(apple) ~= nil) then
3032 p(apple.size, apple.color, getmetatable(apple).__index) 3032 p(apple.size, apple.color, getmetatable(apple).__index)
3033end 3033end
3034local _u1f31b = "月之脚本" 3034local _u1f31b = "Skrip Bulan"
3035_module_0["🌛"] = _u1f31b 3035_module_0["🌛"] = _u1f31b
3036return _module_0 3036return _module_0
3037local _module_0 = { } 3037local _module_0 = { }
@@ -3109,27 +3109,27 @@ local apple = setmetatable({
3109if (getmetatable(apple) ~= nil) then 3109if (getmetatable(apple) ~= nil) then
3110 p(apple.size, apple.color, getmetatable(apple).__index) 3110 p(apple.size, apple.color, getmetatable(apple).__index)
3111end 3111end
3112local _u1f31b = "月之脚本" 3112local _u1f31b = "Skrip Bulan"
3113_module_0["🌛"] = _u1f31b 3113_module_0["🌛"] = _u1f31b
3114return _module_0 3114return _module_0
3115local have_coins = false 3115local have_coins = false
3116if have_coins then 3116if have_coins then
3117 print("Got coins") 3117 print("Dapat koin")
3118else 3118else
3119 print("No coins") 3119 print("Tidak ada koin")
3120end 3120end
3121local have_coins = false 3121local have_coins = false
3122if have_coins then 3122if have_coins then
3123 print("Got coins") 3123 print("Dapat koin")
3124else 3124else
3125 print("No coins") 3125 print("Tidak ada koin")
3126end 3126end
3127local have_coins = false 3127local have_coins = false
3128print((function() 3128print((function()
3129 if have_coins then 3129 if have_coins then
3130 return "Got coins" 3130 return "Dapat koin"
3131 else 3131 else
3132 return "No coins" 3132 return "Tidak ada koin"
3133 end 3133 end
3134end)()) 3134end)())
3135local is_tall 3135local is_tall
@@ -3142,20 +3142,20 @@ is_tall = function(name)
3142end 3142end
3143local message 3143local message
3144if is_tall("Rob") then 3144if is_tall("Rob") then
3145 message = "I am very tall" 3145 message = "Saya sangat tinggi"
3146else 3146else
3147 message = "I am not so tall" 3147 message = "Saya tidak terlalu tinggi"
3148end 3148end
3149print(message) 3149print(message)
3150if not (os.date("%A") == "Monday") then 3150if not (os.date("%A") == "Monday") then
3151 print("it is not Monday!") 3151 print("hari ini bukan Senin!")
3152end 3152end
3153if not (math.random() > 0.1) then 3153if not (math.random() > 0.1) then
3154 print("You're lucky!") 3154 print("Kamu beruntung!")
3155end 3155end
3156local a = 5 3156local a = 5
3157if (1 == a or 3 == a or 5 == a or 7 == a) then 3157if (1 == a or 3 == a or 5 == a or 7 == a) then
3158 print("checking equality with discrete values") 3158 print("memeriksa kesamaan dengan nilai-nilai diskrit")
3159end 3159end
3160if (function() 3160if (function()
3161 local _check_0 = list 3161 local _check_0 = list
@@ -3166,29 +3166,26 @@ if (function()
3166 end 3166 end
3167 return false 3167 return false
3168end)() then 3168end)() then
3169 print("checking if `a` is in a list") 3169 print("memeriksa apakah `a` ada di dalam daftar")
3170end
3171if not (math.random() > 0.1) then
3172 print("You're lucky!")
3173end 3170end
3174local have_coins = false 3171local have_coins = false
3175if have_coins then 3172if have_coins then
3176 print("Got coins") 3173 print("Dapat koin")
3177else 3174else
3178 print("No coins") 3175 print("Tidak ada koin")
3179end 3176end
3180local have_coins = false 3177local have_coins = false
3181if have_coins then 3178if have_coins then
3182 print("Got coins") 3179 print("Dapat koin")
3183else 3180else
3184 print("No coins") 3181 print("Tidak ada koin")
3185end 3182end
3186local have_coins = false 3183local have_coins = false
3187print((function() 3184print((function()
3188 if have_coins then 3185 if have_coins then
3189 return "Got coins" 3186 return "Dapat koin"
3190 else 3187 else
3191 return "No coins" 3188 return "Tidak ada koin"
3192 end 3189 end
3193end)()) 3190end)())
3194local is_tall 3191local is_tall
@@ -3201,20 +3198,20 @@ is_tall = function(name)
3201end 3198end
3202local message 3199local message
3203if is_tall("Rob") then 3200if is_tall("Rob") then
3204 message = "I am very tall" 3201 message = "Saya sangat tinggi"
3205else 3202else
3206 message = "I am not so tall" 3203 message = "Saya tidak terlalu tinggi"
3207end 3204end
3208print(message) 3205print(message)
3209if not (os.date("%A") == "Monday") then 3206if not (os.date("%A") == "Monday") then
3210 print("it is not Monday!") 3207 print("hari ini bukan Senin!")
3211end 3208end
3212if not (math.random() > 0.1) then 3209if not (math.random() > 0.1) then
3213 print("You're lucky!") 3210 print("Kamu beruntung!")
3214end 3211end
3215local a = 5 3212local a = 5
3216if (1 == a or 3 == a or 5 == a or 7 == a) then 3213if (1 == a or 3 == a or 5 == a or 7 == a) then
3217 print("checking equality with discrete values") 3214 print("memeriksa kesamaan dengan nilai-nilai diskrit")
3218end 3215end
3219if (function() 3216if (function()
3220 local _check_0 = list 3217 local _check_0 = list
@@ -3225,10 +3222,7 @@ if (function()
3225 end 3222 end
3226 return false 3223 return false
3227end)() then 3224end)() then
3228 print("checking if `a` is in a list") 3225 print("memeriksa apakah `a` ada di dalam daftar")
3229end
3230if not (math.random() > 0.1) then
3231 print("You're lucky!")
3232end 3226end
3233for i = 10, 20 do 3227for i = 10, 20 do
3234 print(i) 3228 print(i)
diff --git a/spec/outputs/codes_from_doc_pt-br.lua b/spec/outputs/codes_from_doc_pt-br.lua
index 0b3670c..0c9affb 100644
--- a/spec/outputs/codes_from_doc_pt-br.lua
+++ b/spec/outputs/codes_from_doc_pt-br.lua
@@ -93,7 +93,7 @@ funcB = function()
93 return "fail to assign to the Lua macro defined variable" 93 return "fail to assign to the Lua macro defined variable"
94end 94end
95do 95do
96-- raw Lua codes insertion 96-- inserção de códigos Lua brutos
97if cond then 97if cond then
98 print("output") 98 print("output")
99end 99end
@@ -132,7 +132,7 @@ funcB = function()
132 return "fail to assign to the Lua macro defined variable" 132 return "fail to assign to the Lua macro defined variable"
133end 133end
134do 134do
135-- raw Lua codes insertion 135-- inserção de códigos Lua brutos
136if cond then 136if cond then
137 print("output") 137 print("output")
138end 138end
@@ -2476,7 +2476,7 @@ x = x * 10
2476x = x / 10 2476x = x / 10
2477x = x % 10 2477x = x % 10
2478local s = s .. "world" 2478local s = s .. "world"
2479local arg = arg or "default value" 2479local arg = arg or "valor padrão"
2480local a = 0 2480local a = 0
2481local b = 0 2481local b = 0
2482local c = 0 2482local c = 0
@@ -2488,7 +2488,7 @@ local z = x
2488do 2488do
2489 local a = 1 2489 local a = 1
2490 local x, y, z 2490 local x, y, z
2491 print("forward declare all variables as locals") 2491 print("declarar antecipadamente todas as variáveis como locais")
2492 x = function() 2492 x = function()
2493 return 1 + y + z 2493 return 1 + y + z
2494 end 2494 end
@@ -2498,13 +2498,13 @@ end
2498do 2498do
2499 local X = 1 2499 local X = 1
2500 local B 2500 local B
2501 print("only forward declare upper case variables") 2501 print("declarar antecipadamente apenas variáveis em maiúsculas")
2502 local a = 1 2502 local a = 1
2503 B = 2 2503 B = 2
2504end 2504end
2505do 2505do
2506 a = 1 2506 a = 1
2507 print("declare all variables as globals") 2507 print("declarar todas as variáveis como globais")
2508 x = function() 2508 x = function()
2509 return 1 + y + z 2509 return 1 + y + z
2510 end 2510 end
@@ -2512,10 +2512,10 @@ do
2512end 2512end
2513do 2513do
2514 X = 1 2514 X = 1
2515 print("only declare upper case variables as globals") 2515 print("declarar apenas variáveis em masculas como globais")
2516 local a = 1 2516 local a = 1
2517 B = 2 2517 B = 2
2518 local Temp = "a local value" 2518 local Temp = "um valor local"
2519end 2519end
2520local hello = "world" 2520local hello = "world"
2521local a, b, c = 1, 2, 3 2521local a, b, c = 1, 2, 3
@@ -2527,7 +2527,7 @@ x = x * 10
2527x = x / 10 2527x = x / 10
2528x = x % 10 2528x = x % 10
2529local s = s .. "world" 2529local s = s .. "world"
2530local arg = arg or "default value" 2530local arg = arg or "valor padrão"
2531local a = 0 2531local a = 0
2532local b = 0 2532local b = 0
2533local c = 0 2533local c = 0
@@ -2539,7 +2539,7 @@ local z = x
2539do 2539do
2540 local a = 1 2540 local a = 1
2541 local x, y, z 2541 local x, y, z
2542 print("forward declare all variables as locals") 2542 print("declarar antecipadamente todas as variáveis como locais")
2543 x = function() 2543 x = function()
2544 return 1 + y + z 2544 return 1 + y + z
2545 end 2545 end
@@ -2549,13 +2549,13 @@ end
2549do 2549do
2550 local X = 1 2550 local X = 1
2551 local B 2551 local B
2552 print("only forward declare upper case variables") 2552 print("declarar antecipadamente apenas variáveis em maiúsculas")
2553 local a = 1 2553 local a = 1
2554 B = 2 2554 B = 2
2555end 2555end
2556do 2556do
2557 a = 1 2557 a = 1
2558 print("declare all variables as globals") 2558 print("declarar todas as variáveis como globais")
2559 x = function() 2559 x = function()
2560 return 1 + y + z 2560 return 1 + y + z
2561 end 2561 end
@@ -2563,10 +2563,10 @@ do
2563end 2563end
2564do 2564do
2565 X = 1 2565 X = 1
2566 print("only declare upper case variables as globals") 2566 print("declarar apenas variáveis em masculas como globais")
2567 local a = 1 2567 local a = 1
2568 B = 2 2568 B = 2
2569 local Temp = "a local value" 2569 local Temp = "um valor local"
2570end 2570end
2571local list = { 2571local list = {
2572 1, 2572 1,
@@ -2608,18 +2608,18 @@ if user then
2608end 2608end
2609local hello = os.getenv("hello") 2609local hello = os.getenv("hello")
2610if hello then 2610if hello then
2611 print("You have hello", hello) 2611 print("Vo tem hello", hello)
2612else 2612else
2613 local world = os.getenv("world") 2613 local world = os.getenv("world")
2614 if world then 2614 if world then
2615 print("you have world", world) 2615 print("vo tem world", world)
2616 else 2616 else
2617 print("nothing :(") 2617 print("nada :(")
2618 end 2618 end
2619end 2619end
2620do 2620do
2621 local success, result = pcall(function() 2621 local success, result = pcall(function()
2622 return "get result without problems" 2622 return "obter resultado sem problemas"
2623 end) 2623 end)
2624 if success then 2624 if success then
2625 print(result) 2625 print(result)
@@ -2640,18 +2640,18 @@ if user then
2640end 2640end
2641local hello = os.getenv("hello") 2641local hello = os.getenv("hello")
2642if hello then 2642if hello then
2643 print("You have hello", hello) 2643 print("Vo tem hello", hello)
2644else 2644else
2645 local world = os.getenv("world") 2645 local world = os.getenv("world")
2646 if world then 2646 if world then
2647 print("you have world", world) 2647 print("vo tem world", world)
2648 else 2648 else
2649 print("nothing :(") 2649 print("nada :(")
2650 end 2650 end
2651end 2651end
2652do 2652do
2653 local success, result = pcall(function() 2653 local success, result = pcall(function()
2654 return "get result without problems" 2654 return "obter resultado sem problemas"
2655 end) 2655 end)
2656 if success then 2656 if success then
2657 print(result) 2657 print(result)
@@ -2707,10 +2707,10 @@ local name, job
2707local _obj_0 = person 2707local _obj_0 = person
2708name, job = _obj_0.name, _obj_0.job 2708name, job = _obj_0.name, _obj_0.job
2709if name == nil then 2709if name == nil then
2710 name = "nameless" 2710 name = "sem nome"
2711end 2711end
2712if job == nil then 2712if job == nil then
2713 job = "jobless" 2713 job = "sem emprego"
2714end 2714end
2715local two, four 2715local two, four
2716local _obj_0 = items 2716local _obj_0 = items
@@ -2824,10 +2824,10 @@ local name, job
2824local _obj_0 = person 2824local _obj_0 = person
2825name, job = _obj_0.name, _obj_0.job 2825name, job = _obj_0.name, _obj_0.job
2826if name == nil then 2826if name == nil then
2827 name = "nameless" 2827 name = "sem nome"
2828end 2828end
2829if job == nil then 2829if job == nil then
2830 job = "jobless" 2830 job = "sem emprego"
2831end 2831end
2832local two, four 2832local two, four
2833local _obj_0 = items 2833local _obj_0 = items
@@ -3031,7 +3031,7 @@ local apple = setmetatable({
3031if (getmetatable(apple) ~= nil) then 3031if (getmetatable(apple) ~= nil) then
3032 p(apple.size, apple.color, getmetatable(apple).__index) 3032 p(apple.size, apple.color, getmetatable(apple).__index)
3033end 3033end
3034local _u1f31b = "月之脚本" 3034local _u1f31b = "Script da Lua"
3035_module_0["🌛"] = _u1f31b 3035_module_0["🌛"] = _u1f31b
3036return _module_0 3036return _module_0
3037local _module_0 = { } 3037local _module_0 = { }
@@ -3109,27 +3109,27 @@ local apple = setmetatable({
3109if (getmetatable(apple) ~= nil) then 3109if (getmetatable(apple) ~= nil) then
3110 p(apple.size, apple.color, getmetatable(apple).__index) 3110 p(apple.size, apple.color, getmetatable(apple).__index)
3111end 3111end
3112local _u1f31b = "月之脚本" 3112local _u1f31b = "Script da Lua"
3113_module_0["🌛"] = _u1f31b 3113_module_0["🌛"] = _u1f31b
3114return _module_0 3114return _module_0
3115local have_coins = false 3115local have_coins = false
3116if have_coins then 3116if have_coins then
3117 print("Got coins") 3117 print("Tem moedas")
3118else 3118else
3119 print("No coins") 3119 print("Sem moedas")
3120end 3120end
3121local have_coins = false 3121local have_coins = false
3122if have_coins then 3122if have_coins then
3123 print("Got coins") 3123 print("Tem moedas")
3124else 3124else
3125 print("No coins") 3125 print("Sem moedas")
3126end 3126end
3127local have_coins = false 3127local have_coins = false
3128print((function() 3128print((function()
3129 if have_coins then 3129 if have_coins then
3130 return "Got coins" 3130 return "Tem moedas"
3131 else 3131 else
3132 return "No coins" 3132 return "Sem moedas"
3133 end 3133 end
3134end)()) 3134end)())
3135local is_tall 3135local is_tall
@@ -3142,20 +3142,20 @@ is_tall = function(name)
3142end 3142end
3143local message 3143local message
3144if is_tall("Rob") then 3144if is_tall("Rob") then
3145 message = "I am very tall" 3145 message = "Sou muito alto"
3146else 3146else
3147 message = "I am not so tall" 3147 message = "o sou tão alto"
3148end 3148end
3149print(message) 3149print(message)
3150if not (os.date("%A") == "Monday") then 3150if not (os.date("%A") == "Monday") then
3151 print("it is not Monday!") 3151 print("não é segunda-feira!")
3152end 3152end
3153if not (math.random() > 0.1) then 3153if not (math.random() > 0.1) then
3154 print("You're lucky!") 3154 print("Você tem sorte!")
3155end 3155end
3156local a = 5 3156local a = 5
3157if (1 == a or 3 == a or 5 == a or 7 == a) then 3157if (1 == a or 3 == a or 5 == a or 7 == a) then
3158 print("checking equality with discrete values") 3158 print("verificando igualdade com valores discretos")
3159end 3159end
3160if (function() 3160if (function()
3161 local _check_0 = list 3161 local _check_0 = list
@@ -3166,29 +3166,26 @@ if (function()
3166 end 3166 end
3167 return false 3167 return false
3168end)() then 3168end)() then
3169 print("checking if `a` is in a list") 3169 print("verificando se `a` está na lista")
3170end
3171if not (math.random() > 0.1) then
3172 print("You're lucky!")
3173end 3170end
3174local have_coins = false 3171local have_coins = false
3175if have_coins then 3172if have_coins then
3176 print("Got coins") 3173 print("Tem moedas")
3177else 3174else
3178 print("No coins") 3175 print("Sem moedas")
3179end 3176end
3180local have_coins = false 3177local have_coins = false
3181if have_coins then 3178if have_coins then
3182 print("Got coins") 3179 print("Tem moedas")
3183else 3180else
3184 print("No coins") 3181 print("Sem moedas")
3185end 3182end
3186local have_coins = false 3183local have_coins = false
3187print((function() 3184print((function()
3188 if have_coins then 3185 if have_coins then
3189 return "Got coins" 3186 return "Tem moedas"
3190 else 3187 else
3191 return "No coins" 3188 return "Sem moedas"
3192 end 3189 end
3193end)()) 3190end)())
3194local is_tall 3191local is_tall
@@ -3201,20 +3198,20 @@ is_tall = function(name)
3201end 3198end
3202local message 3199local message
3203if is_tall("Rob") then 3200if is_tall("Rob") then
3204 message = "I am very tall" 3201 message = "Sou muito alto"
3205else 3202else
3206 message = "I am not so tall" 3203 message = "o sou tão alto"
3207end 3204end
3208print(message) 3205print(message)
3209if not (os.date("%A") == "Monday") then 3206if not (os.date("%A") == "Monday") then
3210 print("it is not Monday!") 3207 print("não é segunda-feira!")
3211end 3208end
3212if not (math.random() > 0.1) then 3209if not (math.random() > 0.1) then
3213 print("You're lucky!") 3210 print("Você tem sorte!")
3214end 3211end
3215local a = 5 3212local a = 5
3216if (1 == a or 3 == a or 5 == a or 7 == a) then 3213if (1 == a or 3 == a or 5 == a or 7 == a) then
3217 print("checking equality with discrete values") 3214 print("verificando igualdade com valores discretos")
3218end 3215end
3219if (function() 3216if (function()
3220 local _check_0 = list 3217 local _check_0 = list
@@ -3225,10 +3222,7 @@ if (function()
3225 end 3222 end
3226 return false 3223 return false
3227end)() then 3224end)() then
3228 print("checking if `a` is in a list") 3225 print("verificando se `a` está na lista")
3229end
3230if not (math.random() > 0.1) then
3231 print("You're lucky!")
3232end 3226end
3233for i = 10, 20 do 3227for i = 10, 20 do
3234 print(i) 3228 print(i)
@@ -3420,11 +3414,11 @@ end
3420odds = _accum_0 3414odds = _accum_0
3421local name = "Dan" 3415local name = "Dan"
3422if "Robert" == name then 3416if "Robert" == name then
3423 print("You are Robert") 3417 print("Vo é Robert")
3424elseif "Dan" == name or "Daniel" == name then 3418elseif "Dan" == name or "Daniel" == name then
3425 print("Your name, it's Dan") 3419 print("Seu nome é Dan")
3426else 3420else
3427 print("I don't know about you with name " .. tostring(name)) 3421 print("o sei quem vo é com o nome " .. tostring(name))
3428end 3422end
3429local b = 1 3423local b = 1
3430local next_number 3424local next_number
@@ -3433,30 +3427,30 @@ if 1 == b then
3433elseif 2 == b then 3427elseif 2 == b then
3434 next_number = 3 3428 next_number = 3
3435else 3429else
3436 next_number = error("can't count that high!") 3430 next_number = error("não consigo contar tão alto!")
3437end 3431end
3438local msg 3432local msg
3439local _exp_0 = math.random(1, 5) 3433local _exp_0 = math.random(1, 5)
3440if 1 == _exp_0 then 3434if 1 == _exp_0 then
3441 msg = "you are lucky" 3435 msg = "vo tem sorte"
3442elseif 2 == _exp_0 then 3436elseif 2 == _exp_0 then
3443 msg = "you are almost lucky" 3437 msg = "vo quase tem sorte"
3444else 3438else
3445 msg = "not so lucky" 3439 msg = "não tão sortudo"
3446end 3440end
3447do 3441do
3448 local _exp_0 = math.random(1, 5) 3442 local _exp_0 = math.random(1, 5)
3449 if 1 == _exp_0 then 3443 if 1 == _exp_0 then
3450 print("you are lucky") 3444 print("vo tem sorte")
3451 else 3445 else
3452 print("not so lucky") 3446 print("não tão sortudo")
3453 end 3447 end
3454end 3448end
3455local _exp_0 = math.random(1, 5) 3449local _exp_0 = math.random(1, 5)
3456if 1 == _exp_0 then 3450if 1 == _exp_0 then
3457 print("you are lucky") 3451 print("vo tem sorte")
3458else 3452else
3459 print("not so lucky") 3453 print("não tão sortudo")
3460end 3454end
3461local items = { 3455local items = {
3462 { 3456 {
@@ -3486,7 +3480,7 @@ for _index_0 = 1, #items do
3486 local width = item.width 3480 local width = item.width
3487 local height = item.height 3481 local height = item.height
3488 if width ~= nil and height ~= nil then 3482 if width ~= nil and height ~= nil then
3489 print("size " .. tostring(width) .. ", " .. tostring(height)) 3483 print("tamanho " .. tostring(width) .. ", " .. tostring(height))
3490 end 3484 end
3491 end 3485 end
3492 end 3486 end
@@ -3563,7 +3557,7 @@ if _tab_0 then
3563 local result = _exp_0.result 3557 local result = _exp_0.result
3564 if true == _exp_0.success and result ~= nil then 3558 if true == _exp_0.success and result ~= nil then
3565 _match_0 = true 3559 _match_0 = true
3566 print("success", result) 3560 print("sucesso", result)
3567 end 3561 end
3568end 3562end
3569if not _match_0 then 3563if not _match_0 then
@@ -3571,11 +3565,11 @@ if not _match_0 then
3571 if _tab_0 then 3565 if _tab_0 then
3572 if false == _exp_0.success then 3566 if false == _exp_0.success then
3573 _match_1 = true 3567 _match_1 = true
3574 print("failed", result) 3568 print("falhou", result)
3575 end 3569 end
3576 end 3570 end
3577 if not _match_1 then 3571 if not _match_1 then
3578 print("invalid") 3572 print("inválido")
3579 end 3573 end
3580end 3574end
3581local _exp_0 = tb 3575local _exp_0 = tb
@@ -3600,7 +3594,7 @@ if _tab_0 then
3600 end 3594 end
3601 if "success" == _val_0 and content ~= nil then 3595 if "success" == _val_0 and content ~= nil then
3602 _match_0 = true 3596 _match_0 = true
3603 print("success", content) 3597 print("sucesso", content)
3604 end 3598 end
3605end 3599end
3606if not _match_0 then 3600if not _match_0 then
@@ -3623,11 +3617,11 @@ if not _match_0 then
3623 end 3617 end
3624 if "error" == _val_0 and content ~= nil then 3618 if "error" == _val_0 and content ~= nil then
3625 _match_1 = true 3619 _match_1 = true
3626 print("failed", content) 3620 print("erro", content)
3627 end 3621 end
3628 end 3622 end
3629 if not _match_1 then 3623 if not _match_1 then
3630 print("invalid") 3624 print("inválido")
3631 end 3625 end
3632end 3626end
3633local _exp_0 = tb 3627local _exp_0 = tb
@@ -3678,7 +3672,7 @@ if _tab_0 then
3678 end 3672 end
3679 end 3673 end
3680 if 1 == _val_0 and 2 == _val_1 and 3 == _val_2 and 4 == _val_3 and 5 == _val_4 and 6 == _val_5 and fourth ~= nil then 3674 if 1 == _val_0 and 2 == _val_1 and 3 == _val_2 and 4 == _val_3 and 5 == _val_4 and 6 == _val_5 and fourth ~= nil then
3681 print("matched", fourth) 3675 print("correspondido", fourth)
3682 end 3676 end
3683end 3677end
3684local segments = { 3678local segments = {
@@ -3705,18 +3699,18 @@ if _tab_0 then
3705 local resource = segments[#segments - 1] 3699 local resource = segments[#segments - 1]
3706 local action = segments[#segments] 3700 local action = segments[#segments]
3707 if resource ~= nil and action ~= nil then 3701 if resource ~= nil and action ~= nil then
3708 print("Group:", groups) 3702 print("Grupo:", groups)
3709 print("Resource:", resource) 3703 print("Recurso:", resource)
3710 print("Action:", action) 3704 print("Ação:", action)
3711 end 3705 end
3712end 3706end
3713local name = "Dan" 3707local name = "Dan"
3714if "Robert" == name then 3708if "Robert" == name then
3715 print("You are Robert") 3709 print("Vo é Robert")
3716elseif "Dan" == name or "Daniel" == name then 3710elseif "Dan" == name or "Daniel" == name then
3717 print("Your name, it's Dan") 3711 print("Seu nome é Dan")
3718else 3712else
3719 print("I don't know about you with name " .. tostring(name)) 3713 print("o sei quem vo é com o nome " .. tostring(name))
3720end 3714end
3721local b = 1 3715local b = 1
3722local next_number 3716local next_number
@@ -3725,30 +3719,30 @@ if 1 == b then
3725elseif 2 == b then 3719elseif 2 == b then
3726 next_number = 3 3720 next_number = 3
3727else 3721else
3728 next_number = error("can't count that high!") 3722 next_number = error("não consigo contar tão alto!")
3729end 3723end
3730local msg 3724local msg
3731local _exp_0 = math.random(1, 5) 3725local _exp_0 = math.random(1, 5)
3732if 1 == _exp_0 then 3726if 1 == _exp_0 then
3733 msg = "you are lucky" 3727 msg = "vo tem sorte"
3734elseif 2 == _exp_0 then 3728elseif 2 == _exp_0 then
3735 msg = "you are almost lucky" 3729 msg = "vo quase tem sorte"
3736else 3730else
3737 msg = "not so lucky" 3731 msg = "não tão sortudo"
3738end 3732end
3739do 3733do
3740 local _exp_0 = math.random(1, 5) 3734 local _exp_0 = math.random(1, 5)
3741 if 1 == _exp_0 then 3735 if 1 == _exp_0 then
3742 print("you are lucky") 3736 print("vo tem sorte")
3743 else 3737 else
3744 print("not so lucky") 3738 print("não tão sortudo")
3745 end 3739 end
3746end 3740end
3747local _exp_0 = math.random(1, 5) 3741local _exp_0 = math.random(1, 5)
3748if 1 == _exp_0 then 3742if 1 == _exp_0 then
3749 print("you are lucky") 3743 print("vo tem sorte")
3750else 3744else
3751 print("not so lucky") 3745 print("não tão sortudo")
3752end 3746end
3753local items = { 3747local items = {
3754 { 3748 {
@@ -3778,7 +3772,7 @@ for _index_0 = 1, #items do
3778 local width = item.width 3772 local width = item.width
3779 local height = item.height 3773 local height = item.height
3780 if width ~= nil and height ~= nil then 3774 if width ~= nil and height ~= nil then
3781 print("size " .. tostring(width) .. ", " .. tostring(height)) 3775 print("tamanho " .. tostring(width) .. ", " .. tostring(height))
3782 end 3776 end
3783 end 3777 end
3784 end 3778 end
@@ -3855,7 +3849,7 @@ if _tab_0 then
3855 local result = _exp_0.result 3849 local result = _exp_0.result
3856 if true == _exp_0.success and result ~= nil then 3850 if true == _exp_0.success and result ~= nil then
3857 _match_0 = true 3851 _match_0 = true
3858 print("success", result) 3852 print("sucesso", result)
3859 end 3853 end
3860end 3854end
3861if not _match_0 then 3855if not _match_0 then
@@ -3863,11 +3857,11 @@ if not _match_0 then
3863 if _tab_0 then 3857 if _tab_0 then
3864 if false == _exp_0.success then 3858 if false == _exp_0.success then
3865 _match_1 = true 3859 _match_1 = true
3866 print("failed", result) 3860 print("falhou", result)
3867 end 3861 end
3868 end 3862 end
3869 if not _match_1 then 3863 if not _match_1 then
3870 print("invalid") 3864 print("inválido")
3871 end 3865 end
3872end 3866end
3873local _exp_0 = tb 3867local _exp_0 = tb
@@ -3892,7 +3886,7 @@ if _tab_0 then
3892 end 3886 end
3893 if "success" == _val_0 and content ~= nil then 3887 if "success" == _val_0 and content ~= nil then
3894 _match_0 = true 3888 _match_0 = true
3895 print("success", content) 3889 print("sucesso", content)
3896 end 3890 end
3897end 3891end
3898if not _match_0 then 3892if not _match_0 then
@@ -3915,11 +3909,11 @@ if not _match_0 then
3915 end 3909 end
3916 if "error" == _val_0 and content ~= nil then 3910 if "error" == _val_0 and content ~= nil then
3917 _match_1 = true 3911 _match_1 = true
3918 print("failed", content) 3912 print("erro", content)
3919 end 3913 end
3920 end 3914 end
3921 if not _match_1 then 3915 if not _match_1 then
3922 print("invalid") 3916 print("inválido")
3923 end 3917 end
3924end 3918end
3925local _exp_0 = tb 3919local _exp_0 = tb
@@ -3970,7 +3964,7 @@ if _tab_0 then
3970 end 3964 end
3971 end 3965 end
3972 if 1 == _val_0 and 2 == _val_1 and 3 == _val_2 and 4 == _val_3 and 5 == _val_4 and 6 == _val_5 and fourth ~= nil then 3966 if 1 == _val_0 and 2 == _val_1 and 3 == _val_2 and 4 == _val_3 and 5 == _val_4 and 6 == _val_5 and fourth ~= nil then
3973 print("matched", fourth) 3967 print("correspondido", fourth)
3974 end 3968 end
3975end 3969end
3976local segments = { 3970local segments = {
@@ -3997,9 +3991,9 @@ if _tab_0 then
3997 local resource = segments[#segments - 1] 3991 local resource = segments[#segments - 1]
3998 local action = segments[#segments] 3992 local action = segments[#segments]
3999 if resource ~= nil and action ~= nil then 3993 if resource ~= nil and action ~= nil then
4000 print("Group:", groups) 3994 print("Grupo:", groups)
4001 print("Resource:", resource) 3995 print("Recurso:", resource)
4002 print("Action:", action) 3996 print("Ação:", action)
4003 end 3997 end
4004end 3998end
4005local i = 10 3999local i = 10
@@ -4288,8 +4282,8 @@ f = function(...)
4288 n = select("#", ...), 4282 n = select("#", ...),
4289 ... 4283 ...
4290 } 4284 }
4291 print("argument count:", t.n) 4285 print("contagem de argumentos:", t.n)
4292 print("table length:", #t) 4286 print("comprimento da tabela:", #t)
4293 for i = 1, t.n do 4287 for i = 1, t.n do
4294 print(t[i]) 4288 print(t[i])
4295 end 4289 end
@@ -4472,8 +4466,8 @@ f = function(...)
4472 n = select("#", ...), 4466 n = select("#", ...),
4473 ... 4467 ...
4474 } 4468 }
4475 print("argument count:", t.n) 4469 print("contagem de argumentos:", t.n)
4476 print("table length:", #t) 4470 print("comprimento da tabela:", #t)
4477 for i = 1, t.n do 4471 for i = 1, t.n do
4478 print(t[i]) 4472 print(t[i])
4479 end 4473 end
@@ -4519,7 +4513,7 @@ func(3000, "192.168.1.1")
4519local a <const> = 123 4513local a <const> = 123
4520local _ <close> = setmetatable({ }, { 4514local _ <close> = setmetatable({ }, {
4521 __close = function() 4515 __close = function()
4522 return print("Out of scope.") 4516 return print("Fora do escopo.")
4523 end 4517 end
4524}) 4518})
4525local a, b, c, d 4519local a, b, c, d
@@ -4529,7 +4523,7 @@ Constant = 123
4529local a <const> = 123 4523local a <const> = 123
4530local _ <close> = setmetatable({ }, { 4524local _ <close> = setmetatable({ }, {
4531 __close = function() 4525 __close = function()
4532 return print("Out of scope.") 4526 return print("Fora do escopo.")
4533 end 4527 end
4534}) 4528})
4535local a, b, c, d 4529local a, b, c, d
@@ -4688,7 +4682,7 @@ local d = a + b + c
4688print(d.value) 4682print(d.value)
4689local _ <close> = setmetatable({ }, { 4683local _ <close> = setmetatable({ }, {
4690 __close = function() 4684 __close = function()
4691 return print("out of scope") 4685 return print("fora do escopo")
4692 end 4686 end
4693}) 4687})
4694local tb = setmetatable({ }, { 4688local tb = setmetatable({ }, {
@@ -4981,7 +4975,7 @@ local d = a + b + c
4981print(d.value) 4975print(d.value)
4982local _ <close> = setmetatable({ }, { 4976local _ <close> = setmetatable({ }, {
4983 __close = function() 4977 __close = function()
4984 return print("out of scope") 4978 return print("fora do escopo")
4985 end 4979 end
4986}) 4980})
4987local tb = setmetatable({ }, { 4981local tb = setmetatable({ }, {
@@ -5122,8 +5116,8 @@ local tb = {
5122 } 5116 }
5123 } 5117 }
5124} 5118}
5125local some_string = "Here is a string\n that has a line break in it." 5119local some_string = "Aqui es uma string\n que tem uma quebra de linha."
5126print("I am " .. tostring(math.random() * 100) .. "% sure.") 5120print("Tenho " .. tostring(math.random() * 100) .. "% de certeza.")
5127local integer = 1000000 5121local integer = 1000000
5128local hex = 0xEFBBBF 5122local hex = 0xEFBBBF
5129local binary = 19 5123local binary = 19
@@ -5133,9 +5127,9 @@ fn = function()
5133 local str = "foo:\n bar: baz" 5127 local str = "foo:\n bar: baz"
5134 return str 5128 return str
5135end 5129end
5136local str = "path: \"C:\\Program Files\\App\"\nnote: 'He said: \"" .. tostring(Hello) .. "!\"'" 5130local str = "path: \"C:\\Program Files\\App\"\nnote: 'Ele disse: \"" .. tostring(Hello) .. "!\"'"
5137local some_string = "Here is a string\n that has a line break in it." 5131local some_string = "Aqui es uma string\n que tem uma quebra de linha."
5138print("I am " .. tostring(math.random() * 100) .. "% sure.") 5132print("Tenho " .. tostring(math.random() * 100) .. "% de certeza.")
5139local integer = 1000000 5133local integer = 1000000
5140local hex = 0xEFBBBF 5134local hex = 0xEFBBBF
5141local binary = 19 5135local binary = 19
@@ -5145,4 +5139,4 @@ fn = function()
5145 local str = "foo:\n bar: baz" 5139 local str = "foo:\n bar: baz"
5146 return str 5140 return str
5147end 5141end
5148local str = "path: \"C:\\Program Files\\App\"\nnote: 'He said: \"" .. tostring(Hello) .. "!\"'" 5142local str = "path: \"C:\\Program Files\\App\"\nnote: 'Ele disse: \"" .. tostring(Hello) .. "!\"'"
diff --git a/spec/outputs/codes_from_doc_zh.lua b/spec/outputs/codes_from_doc_zh.lua
index e0d364d..fa985e2 100644
--- a/spec/outputs/codes_from_doc_zh.lua
+++ b/spec/outputs/codes_from_doc_zh.lua
@@ -3168,9 +3168,6 @@ if (function()
3168end)() then 3168end)() then
3169 print("检查`a`是否在列表中") 3169 print("检查`a`是否在列表中")
3170end 3170end
3171if not (math.random() > 0.1) then
3172 print("你很幸运!")
3173end
3174local have_coins = false 3171local have_coins = false
3175if have_coins then 3172if have_coins then
3176 print("有硬币") 3173 print("有硬币")
@@ -3227,9 +3224,6 @@ if (function()
3227end)() then 3224end)() then
3228 print("检查`a`是否在列表中") 3225 print("检查`a`是否在列表中")
3229end 3226end
3230if not (math.random() > 0.1) then
3231 print("你很幸运!")
3232end
3233for i = 10, 20 do 3227for i = 10, 20 do
3234 print(i) 3228 print(i)
3235end 3229end