diff options
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/outputs/codes_from_doc_de.lua | 554 | ||||
| -rw-r--r-- | spec/outputs/codes_from_doc_en.lua | 10 | ||||
| -rw-r--r-- | spec/outputs/codes_from_doc_id-id.lua | 86 | ||||
| -rw-r--r-- | spec/outputs/codes_from_doc_pt-br.lua | 226 | ||||
| -rw-r--r-- | spec/outputs/codes_from_doc_zh.lua | 6 |
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 @@ | |||
| 1 | do | 1 | do |
| 2 | local var = "hello" | 2 | local var = "hallo" |
| 3 | print(var) | 3 | print(var) |
| 4 | end | 4 | end |
| 5 | print(var) | 5 | print(var) |
| @@ -15,12 +15,12 @@ print(counter()) | |||
| 15 | print(counter()) | 15 | print(counter()) |
| 16 | local tbl = { | 16 | local 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 | } |
| 22 | do | 22 | do |
| 23 | local var = "hello" | 23 | local var = "hallo" |
| 24 | print(var) | 24 | print(var) |
| 25 | end | 25 | end |
| 26 | print(var) | 26 | print(var) |
| @@ -36,17 +36,17 @@ print(counter()) | |||
| 36 | print(counter()) | 36 | print(counter()) |
| 37 | local tbl = { | 37 | local 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 | } |
| 43 | if name == "Rob" then | 43 | if name == "Rob" then |
| 44 | print("hello world") | 44 | print("Hallo Welt") |
| 45 | end | 45 | end |
| 46 | local _list_0 = items | 46 | local _list_0 = items |
| 47 | for _index_0 = 1, #_list_0 do | 47 | for _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) |
| 50 | end | 50 | end |
| 51 | while game:isRunning() do | 51 | while 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() |
| 56 | end | 56 | end |
| 57 | if name == "Rob" then | 57 | if name == "Rob" then |
| 58 | print("hello world") | 58 | print("Hallo Welt") |
| 59 | end | 59 | end |
| 60 | local _list_0 = items | 60 | local _list_0 = items |
| 61 | for _index_0 = 1, #_list_0 do | 61 | for _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) |
| 64 | end | 64 | end |
| 65 | while game:isRunning() do | 65 | while 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() |
| 70 | end | 70 | end |
| 71 | local area = 6.2831853071796 * 5 | 71 | local area = 6.2831853071796 * 5 |
| 72 | print('hello world') | 72 | print('Hallo Welt') |
| 73 | do | 73 | do |
| 74 | assert(item ~= nil) | 74 | assert(item ~= nil) |
| 75 | end | 75 | end |
| @@ -83,32 +83,32 @@ do | |||
| 83 | end | 83 | end |
| 84 | local funcA | 84 | local funcA |
| 85 | funcA = function() | 85 | funcA = 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" |
| 87 | end | 87 | end |
| 88 | do | 88 | do |
| 89 | local function funcB() end | 89 | local function funcB() end |
| 90 | end | 90 | end |
| 91 | local funcB | 91 | local funcB |
| 92 | funcB = function() | 92 | funcB = 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" |
| 94 | end | 94 | end |
| 95 | do | 95 | do |
| 96 | -- raw Lua codes insertion | 96 | -- Einfügen von rohem Lua-Code |
| 97 | if cond then | 97 | if cond then |
| 98 | print("output") | 98 | print("Ausgabe") |
| 99 | end | 99 | end |
| 100 | end | 100 | end |
| 101 | print("yuescript") | 101 | print("yuescript") |
| 102 | print(2) | 102 | print(2) |
| 103 | print("Valid enum type:", "Static") | 103 | print("Gültiger Enum-Typ:", "Static") |
| 104 | do | 104 | do |
| 105 | print(123, "hello") | 105 | print(123, "hallo") |
| 106 | end | 106 | end |
| 107 | do | 107 | do |
| 108 | print(123, "hello") | 108 | print(123, "hallo") |
| 109 | end | 109 | end |
| 110 | local area = 6.2831853071796 * 5 | 110 | local area = 6.2831853071796 * 5 |
| 111 | print('hello world') | 111 | print('Hallo Welt') |
| 112 | do | 112 | do |
| 113 | assert(item ~= nil) | 113 | assert(item ~= nil) |
| 114 | end | 114 | end |
| @@ -122,29 +122,29 @@ do | |||
| 122 | end | 122 | end |
| 123 | local funcA | 123 | local funcA |
| 124 | funcA = function() | 124 | funcA = 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" |
| 126 | end | 126 | end |
| 127 | do | 127 | do |
| 128 | local function funcB() end | 128 | local function funcB() end |
| 129 | end | 129 | end |
| 130 | local funcB | 130 | local funcB |
| 131 | funcB = function() | 131 | funcB = 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" |
| 133 | end | 133 | end |
| 134 | do | 134 | do |
| 135 | -- raw Lua codes insertion | 135 | -- Einfügen von rohem Lua-Code |
| 136 | if cond then | 136 | if cond then |
| 137 | print("output") | 137 | print("Ausgabe") |
| 138 | end | 138 | end |
| 139 | end | 139 | end |
| 140 | print("yuescript") | 140 | print("yuescript") |
| 141 | print(2) | 141 | print(2) |
| 142 | print("Valid enum type:", "Static") | 142 | print("Gültiger Enum-Typ:", "Static") |
| 143 | do | 143 | do |
| 144 | print(123, "hello") | 144 | print(123, "hallo") |
| 145 | end | 145 | end |
| 146 | do | 146 | do |
| 147 | print(123, "hello") | 147 | print(123, "hallo") |
| 148 | end | 148 | end |
| 149 | do | 149 | do |
| 150 | local insert, concat = table.insert, table.concat | 150 | local insert, concat = table.insert, table.concat |
| @@ -190,7 +190,7 @@ end | |||
| 190 | do | 190 | do |
| 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) |
| 195 | end | 195 | end |
| 196 | do | 196 | do |
| @@ -201,7 +201,7 @@ end | |||
| 201 | local _module_0 = { } | 201 | local _module_0 = { } |
| 202 | local a, b, c = 1, 2, 3 | 202 | local 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 |
| 204 | local cool = "cat" | 204 | local cool = "Katze" |
| 205 | _module_0["cool"] = cool | 205 | _module_0["cool"] = cool |
| 206 | local What | 206 | local What |
| 207 | if this then | 207 | if this then |
| @@ -273,7 +273,7 @@ _module_0[#_module_0 + 1] = _with_0 | |||
| 273 | return _module_0 | 273 | return _module_0 |
| 274 | local _module_0 = nil | 274 | local _module_0 = nil |
| 275 | _module_0 = function() | 275 | _module_0 = function() |
| 276 | print("hello") | 276 | print("hallo") |
| 277 | return 123 | 277 | return 123 |
| 278 | end | 278 | end |
| 279 | return _module_0 | 279 | return _module_0 |
| @@ -321,7 +321,7 @@ end | |||
| 321 | do | 321 | do |
| 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) |
| 326 | end | 326 | end |
| 327 | do | 327 | do |
| @@ -332,7 +332,7 @@ end | |||
| 332 | local _module_0 = { } | 332 | local _module_0 = { } |
| 333 | local a, b, c = 1, 2, 3 | 333 | local 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 |
| 335 | local cool = "cat" | 335 | local cool = "Katze" |
| 336 | _module_0["cool"] = cool | 336 | _module_0["cool"] = cool |
| 337 | local What | 337 | local What |
| 338 | if this then | 338 | if this then |
| @@ -404,7 +404,7 @@ _module_0[#_module_0 + 1] = _with_0 | |||
| 404 | return _module_0 | 404 | return _module_0 |
| 405 | local _module_0 = nil | 405 | local _module_0 = nil |
| 406 | _module_0 = function() | 406 | _module_0 = function() |
| 407 | print("hello") | 407 | print("hallo") |
| 408 | return 123 | 408 | return 123 |
| 409 | end | 409 | end |
| 410 | return _module_0 | 410 | return _module_0 |
| @@ -427,7 +427,7 @@ success, result = pcall(function() | |||
| 427 | return func(1, 2, 3) | 427 | return func(1, 2, 3) |
| 428 | end) | 428 | end) |
| 429 | pcall(function() | 429 | pcall(function() |
| 430 | print("trying") | 430 | print("Versuche") |
| 431 | return func(1, 2, 3) | 431 | return func(1, 2, 3) |
| 432 | end) | 432 | end) |
| 433 | success, result = xpcall(function() | 433 | success, 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 |
| 466 | end | 466 | end |
| 467 | f((function() | 467 | f((function() |
| @@ -507,7 +507,7 @@ success, result = pcall(function() | |||
| 507 | return func(1, 2, 3) | 507 | return func(1, 2, 3) |
| 508 | end) | 508 | end) |
| 509 | pcall(function() | 509 | pcall(function() |
| 510 | print("trying") | 510 | print("Versuche") |
| 511 | return func(1, 2, 3) | 511 | return func(1, 2, 3) |
| 512 | end) | 512 | end) |
| 513 | success, result = xpcall(function() | 513 | success, 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 |
| 546 | end | 546 | end |
| 547 | f((function() | 547 | f((function() |
| @@ -577,14 +577,14 @@ local some_values = { | |||
| 577 | local some_values = { | 577 | local some_values = { |
| 578 | name = "Bill", | 578 | name = "Bill", |
| 579 | age = 200, | 579 | age = 200, |
| 580 | ["favorite food"] = "rice" | 580 | ["Lieblingsessen"] = "Reis" |
| 581 | } | 581 | } |
| 582 | local profile = { | 582 | local 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 | } |
| 590 | local values = { | 590 | local 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 | } |
| 602 | my_function({ | 602 | my_function({ |
| 603 | dance = "Tango", | 603 | dance = "Tango", |
| 604 | partner = "none" | 604 | partner = "keiner" |
| 605 | }) | 605 | }) |
| 606 | local y = { | 606 | local y = { |
| 607 | type = "dog", | 607 | type = "Hund", |
| 608 | legs = 4, | 608 | legs = 4, |
| 609 | tails = 1 | 609 | tails = 1 |
| 610 | } | 610 | } |
| 611 | local tbl = { | 611 | local tbl = { |
| 612 | ["do"] = "something", | 612 | ["do"] = "etwas", |
| 613 | ["end"] = "hunger" | 613 | ["end"] = "Hunger" |
| 614 | } | 614 | } |
| 615 | local hair = "golden" | 615 | local hair = "golden" |
| 616 | local height = 200 | 616 | local height = 200 |
| @@ -624,8 +624,8 @@ print_table({ | |||
| 624 | height = height | 624 | height = height |
| 625 | }) | 625 | }) |
| 626 | local t = { | 626 | local t = { |
| 627 | [1 + 2] = "hello", | 627 | [1 + 2] = "hallo", |
| 628 | ["hello world"] = true | 628 | ["Hallo Welt"] = true |
| 629 | } | 629 | } |
| 630 | local some_values = { | 630 | local some_values = { |
| 631 | 1, | 631 | 1, |
| @@ -645,14 +645,14 @@ local some_values = { | |||
| 645 | local some_values = { | 645 | local some_values = { |
| 646 | name = "Bill", | 646 | name = "Bill", |
| 647 | age = 200, | 647 | age = 200, |
| 648 | ["favorite food"] = "rice" | 648 | ["Lieblingsessen"] = "Reis" |
| 649 | } | 649 | } |
| 650 | local profile = { | 650 | local 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 | } |
| 658 | local values = { | 658 | local 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 | } |
| 670 | my_function({ | 670 | my_function({ |
| 671 | dance = "Tango", | 671 | dance = "Tango", |
| 672 | partner = "none" | 672 | partner = "keiner" |
| 673 | }) | 673 | }) |
| 674 | local y = { | 674 | local y = { |
| 675 | type = "dog", | 675 | type = "Hund", |
| 676 | legs = 4, | 676 | legs = 4, |
| 677 | tails = 1 | 677 | tails = 1 |
| 678 | } | 678 | } |
| 679 | local tbl = { | 679 | local tbl = { |
| 680 | ["do"] = "something", | 680 | ["do"] = "etwas", |
| 681 | ["end"] = "hunger" | 681 | ["end"] = "Hunger" |
| 682 | } | 682 | } |
| 683 | local hair = "golden" | 683 | local hair = "golden" |
| 684 | local height = 200 | 684 | local height = 200 |
| @@ -692,8 +692,8 @@ print_table({ | |||
| 692 | height = height | 692 | height = height |
| 693 | }) | 693 | }) |
| 694 | local t = { | 694 | local t = { |
| 695 | [1 + 2] = "hello", | 695 | [1 + 2] = "hallo", |
| 696 | ["hello world"] = true | 696 | ["Hallo Welt"] = true |
| 697 | } | 697 | } |
| 698 | local some_values = { | 698 | local some_values = { |
| 699 | 1, | 699 | 1, |
| @@ -797,8 +797,8 @@ for i = 1, 100 do | |||
| 797 | end | 797 | end |
| 798 | evens = _accum_0 | 798 | evens = _accum_0 |
| 799 | local thing = { | 799 | local thing = { |
| 800 | color = "red", | 800 | color = "rot", |
| 801 | name = "fast", | 801 | name = "schnell", |
| 802 | width = 123 | 802 | width = 123 |
| 803 | } | 803 | } |
| 804 | local thing_copy | 804 | local thing_copy |
| @@ -830,8 +830,8 @@ end | |||
| 830 | sqrts = _tbl_0 | 830 | sqrts = _tbl_0 |
| 831 | local tuples = { | 831 | local 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 | |||
| 1018 | end | 1018 | end |
| 1019 | evens = _accum_0 | 1019 | evens = _accum_0 |
| 1020 | local thing = { | 1020 | local thing = { |
| 1021 | color = "red", | 1021 | color = "rot", |
| 1022 | name = "fast", | 1022 | name = "schnell", |
| 1023 | width = 123 | 1023 | width = 123 |
| 1024 | } | 1024 | } |
| 1025 | local thing_copy | 1025 | local thing_copy |
| @@ -1051,8 +1051,8 @@ end | |||
| 1051 | sqrts = _tbl_0 | 1051 | sqrts = _tbl_0 |
| 1052 | local tuples = { | 1052 | local 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 |
| 1179 | Inventory = _class_0 | 1179 | Inventory = _class_0 |
| 1180 | local inv = Inventory() | 1180 | local inv = Inventory() |
| 1181 | inv:add_item("t-shirt") | 1181 | inv:add_item("T-Shirt") |
| 1182 | inv:add_item("pants") | 1182 | inv:add_item("Hose") |
| 1183 | local Person | 1183 | local Person |
| 1184 | do | 1184 | do |
| 1185 | local _class_0 | 1185 | local _class_0 |
| @@ -1209,8 +1209,8 @@ do | |||
| 1209 | end | 1209 | end |
| 1210 | local a = Person() | 1210 | local a = Person() |
| 1211 | local b = Person() | 1211 | local b = Person() |
| 1212 | a:give_item("pants") | 1212 | a:give_item("Hose") |
| 1213 | b:give_item("shirt") | 1213 | b:give_item("Hemd") |
| 1214 | local _list_0 = a.clothes | 1214 | local _list_0 = a.clothes |
| 1215 | for _index_0 = 1, #_list_0 do | 1215 | for _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 |
| 1317 | end | 1317 | end |
| @@ -1363,9 +1363,9 @@ local _class_0 | |||
| 1363 | local _parent_0 = ParentClass | 1363 | local _parent_0 = ParentClass |
| 1364 | local _base_0 = { | 1364 | local _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 |
| 1440 | end | 1440 | end |
| @@ -1490,14 +1490,14 @@ _class_0 = setmetatable({ | |||
| 1490 | }) | 1490 | }) |
| 1491 | _base_0.__class = _class_0 | 1491 | _base_0.__class = _class_0 |
| 1492 | local self = _class_0; | 1492 | local self = _class_0; |
| 1493 | self.class_var = "hello world" | 1493 | self.class_var = "Hallo Welt" |
| 1494 | Things = _class_0 | 1494 | Things = _class_0 |
| 1495 | local MoreThings | 1495 | local MoreThings |
| 1496 | local _class_0 | 1496 | local _class_0 |
| 1497 | local secret, log | 1497 | local secret, log |
| 1498 | local _base_0 = { | 1498 | local _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 | } |
| 1503 | if _base_0.__index == nil then | 1503 | if _base_0.__index == nil then |
| @@ -1798,8 +1798,8 @@ _class_0 = setmetatable({ | |||
| 1798 | _base_0.__class = _class_0 | 1798 | _base_0.__class = _class_0 |
| 1799 | Inventory = _class_0 | 1799 | Inventory = _class_0 |
| 1800 | local inv = Inventory() | 1800 | local inv = Inventory() |
| 1801 | inv:add_item("t-shirt") | 1801 | inv:add_item("T-Shirt") |
| 1802 | inv:add_item("pants") | 1802 | inv:add_item("Hose") |
| 1803 | local Person | 1803 | local Person |
| 1804 | do | 1804 | do |
| 1805 | local _class_0 | 1805 | local _class_0 |
| @@ -1829,8 +1829,8 @@ do | |||
| 1829 | end | 1829 | end |
| 1830 | local a = Person() | 1830 | local a = Person() |
| 1831 | local b = Person() | 1831 | local b = Person() |
| 1832 | a:give_item("pants") | 1832 | a:give_item("Hose") |
| 1833 | b:give_item("shirt") | 1833 | b:give_item("Hemd") |
| 1834 | local _list_0 = a.clothes | 1834 | local _list_0 = a.clothes |
| 1835 | for _index_0 = 1, #_list_0 do | 1835 | for _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 |
| 1937 | end | 1937 | end |
| @@ -1983,9 +1983,9 @@ local _class_0 | |||
| 1983 | local _parent_0 = ParentClass | 1983 | local _parent_0 = ParentClass |
| 1984 | local _base_0 = { | 1984 | local _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 |
| 2060 | end | 2060 | end |
| @@ -2110,14 +2110,14 @@ _class_0 = setmetatable({ | |||
| 2110 | }) | 2110 | }) |
| 2111 | _base_0.__class = _class_0 | 2111 | _base_0.__class = _class_0 |
| 2112 | local self = _class_0; | 2112 | local self = _class_0; |
| 2113 | self.class_var = "hello world" | 2113 | self.class_var = "Hallo Welt" |
| 2114 | Things = _class_0 | 2114 | Things = _class_0 |
| 2115 | local MoreThings | 2115 | local MoreThings |
| 2116 | local _class_0 | 2116 | local _class_0 |
| 2117 | local secret, log | 2117 | local secret, log |
| 2118 | local _base_0 = { | 2118 | local _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 | } |
| 2123 | if _base_0.__index == nil then | 2123 | if _base_0.__index == nil then |
| @@ -2392,7 +2392,7 @@ _with_0:add_relative(my_dad) | |||
| 2392 | _with_0:save() | 2392 | _with_0:save() |
| 2393 | print(_with_0.name) | 2393 | print(_with_0.name) |
| 2394 | local file | 2394 | local file |
| 2395 | local _with_0 = File("favorite_foods.txt") | 2395 | local _with_0 = File("Lieblingsessen.txt") |
| 2396 | _with_0:set_encoding("utf8") | 2396 | _with_0:set_encoding("utf8") |
| 2397 | file = _with_0 | 2397 | file = _with_0 |
| 2398 | local create_person | 2398 | local create_person |
| @@ -2410,9 +2410,9 @@ local me = create_person("Leaf", { | |||
| 2410 | mother, | 2410 | mother, |
| 2411 | sister | 2411 | sister |
| 2412 | }) | 2412 | }) |
| 2413 | local str = "Hello" | 2413 | local str = "Hallo" |
| 2414 | print("original:", str) | 2414 | print("Original:", str) |
| 2415 | print("upper:", str:upper()) | 2415 | print("Großbuchstaben:", str:upper()) |
| 2416 | local _with_0 = tb | 2416 | local _with_0 = tb |
| 2417 | _with_0[1] = 1 | 2417 | _with_0[1] = 1 |
| 2418 | print(_with_0[2]) | 2418 | print(_with_0[2]) |
| @@ -2432,7 +2432,7 @@ _with_0:add_relative(my_dad) | |||
| 2432 | _with_0:save() | 2432 | _with_0:save() |
| 2433 | print(_with_0.name) | 2433 | print(_with_0.name) |
| 2434 | local file | 2434 | local file |
| 2435 | local _with_0 = File("favorite_foods.txt") | 2435 | local _with_0 = File("Lieblingsessen.txt") |
| 2436 | _with_0:set_encoding("utf8") | 2436 | _with_0:set_encoding("utf8") |
| 2437 | file = _with_0 | 2437 | file = _with_0 |
| 2438 | local create_person | 2438 | local create_person |
| @@ -2450,9 +2450,9 @@ local me = create_person("Leaf", { | |||
| 2450 | mother, | 2450 | mother, |
| 2451 | sister | 2451 | sister |
| 2452 | }) | 2452 | }) |
| 2453 | local str = "Hello" | 2453 | local str = "Hallo" |
| 2454 | print("original:", str) | 2454 | print("Original:", str) |
| 2455 | print("upper:", str:upper()) | 2455 | print("Großbuchstaben:", str:upper()) |
| 2456 | local _with_0 = tb | 2456 | local _with_0 = tb |
| 2457 | _with_0[1] = 1 | 2457 | _with_0[1] = 1 |
| 2458 | print(_with_0[2]) | 2458 | print(_with_0[2]) |
| @@ -2608,18 +2608,18 @@ if user then | |||
| 2608 | end | 2608 | end |
| 2609 | local hello = os.getenv("hello") | 2609 | local hello = os.getenv("hello") |
| 2610 | if hello then | 2610 | if hello then |
| 2611 | print("You have hello", hello) | 2611 | print("Du hast hello", hello) |
| 2612 | else | 2612 | else |
| 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 |
| 2619 | end | 2619 | end |
| 2620 | do | 2620 | do |
| 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 | |||
| 2640 | end | 2640 | end |
| 2641 | local hello = os.getenv("hello") | 2641 | local hello = os.getenv("hello") |
| 2642 | if hello then | 2642 | if hello then |
| 2643 | print("You have hello", hello) | 2643 | print("Du hast hello", hello) |
| 2644 | else | 2644 | else |
| 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 |
| 2651 | end | 2651 | end |
| 2652 | do | 2652 | do |
| 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 = { | |||
| 2673 | local a, b = thing[1], thing[2] | 2673 | local a, b = thing[1], thing[2] |
| 2674 | print(a, b) | 2674 | print(a, b) |
| 2675 | local obj = { | 2675 | local obj = { |
| 2676 | hello = "world", | 2676 | hello = "Welt", |
| 2677 | day = "tuesday", | 2677 | day = "Dienstag", |
| 2678 | length = 20 | 2678 | length = 20 |
| 2679 | } | 2679 | } |
| 2680 | local hello, the_day = obj.hello, obj.day | 2680 | local 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 | |||
| 2707 | local _obj_0 = person | 2707 | local _obj_0 = person |
| 2708 | name, job = _obj_0.name, _obj_0.job | 2708 | name, job = _obj_0.name, _obj_0.job |
| 2709 | if name == nil then | 2709 | if name == nil then |
| 2710 | name = "nameless" | 2710 | name = "namenlos" |
| 2711 | end | 2711 | end |
| 2712 | if job == nil then | 2712 | if job == nil then |
| 2713 | job = "jobless" | 2713 | job = "arbeitlos" |
| 2714 | end | 2714 | end |
| 2715 | local two, four | 2715 | local two, four |
| 2716 | local _obj_0 = items | 2716 | local _obj_0 = items |
| 2717 | two, four = _obj_0[2], _obj_0[4] | 2717 | two, four = _obj_0[2], _obj_0[4] |
| 2718 | local orders = { | 2718 | local orders = { |
| 2719 | "first", | 2719 | "erster", |
| 2720 | "second", | 2720 | "zweiter", |
| 2721 | "third", | 2721 | "dritter", |
| 2722 | "fourth", | 2722 | "vierter", |
| 2723 | "last" | 2723 | "letzter" |
| 2724 | } | 2724 | } |
| 2725 | local first, bulk, last = orders[1], (function() | 2725 | local first, bulk, last = orders[1], (function() |
| 2726 | local _accum_0 = { } | 2726 | local _accum_0 = { } |
| @@ -2770,12 +2770,12 @@ local _obj_0 = orders | |||
| 2770 | first, last = _obj_0[1], _obj_0[#_obj_0] | 2770 | first, last = _obj_0[1], _obj_0[#_obj_0] |
| 2771 | local tuples = { | 2771 | local 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 | } |
| 2781 | for _index_0 = 1, #tuples do | 2781 | for _index_0 = 1, #tuples do |
| @@ -2790,8 +2790,8 @@ local thing = { | |||
| 2790 | local a, b = thing[1], thing[2] | 2790 | local a, b = thing[1], thing[2] |
| 2791 | print(a, b) | 2791 | print(a, b) |
| 2792 | local obj = { | 2792 | local obj = { |
| 2793 | hello = "world", | 2793 | hello = "Welt", |
| 2794 | day = "tuesday", | 2794 | day = "Dienstag", |
| 2795 | length = 20 | 2795 | length = 20 |
| 2796 | } | 2796 | } |
| 2797 | local hello, the_day = obj.hello, obj.day | 2797 | local 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 | |||
| 2824 | local _obj_0 = person | 2824 | local _obj_0 = person |
| 2825 | name, job = _obj_0.name, _obj_0.job | 2825 | name, job = _obj_0.name, _obj_0.job |
| 2826 | if name == nil then | 2826 | if name == nil then |
| 2827 | name = "nameless" | 2827 | name = "namenlos" |
| 2828 | end | 2828 | end |
| 2829 | if job == nil then | 2829 | if job == nil then |
| 2830 | job = "jobless" | 2830 | job = "arbeitlos" |
| 2831 | end | 2831 | end |
| 2832 | local two, four | 2832 | local two, four |
| 2833 | local _obj_0 = items | 2833 | local _obj_0 = items |
| 2834 | two, four = _obj_0[2], _obj_0[4] | 2834 | two, four = _obj_0[2], _obj_0[4] |
| 2835 | local orders = { | 2835 | local orders = { |
| 2836 | "first", | 2836 | "erster", |
| 2837 | "second", | 2837 | "zweiter", |
| 2838 | "third", | 2838 | "dritter", |
| 2839 | "fourth", | 2839 | "vierter", |
| 2840 | "last" | 2840 | "letzter" |
| 2841 | } | 2841 | } |
| 2842 | local first, bulk, last = orders[1], (function() | 2842 | local first, bulk, last = orders[1], (function() |
| 2843 | local _accum_0 = { } | 2843 | local _accum_0 = { } |
| @@ -2887,12 +2887,12 @@ local _obj_0 = orders | |||
| 2887 | first, last = _obj_0[1], _obj_0[#_obj_0] | 2887 | first, last = _obj_0[1], _obj_0[#_obj_0] |
| 2888 | local tuples = { | 2888 | local 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 | } |
| 2898 | for _index_0 = 1, #tuples do | 2898 | for _index_0 = 1, #tuples do |
| @@ -2964,16 +2964,16 @@ do | |||
| 2964 | end | 2964 | end |
| 2965 | local inventory = { | 2965 | local 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({ | |||
| 3031 | if (getmetatable(apple) ~= nil) then | 3031 | if (getmetatable(apple) ~= nil) then |
| 3032 | p(apple.size, apple.color, getmetatable(apple).__index) | 3032 | p(apple.size, apple.color, getmetatable(apple).__index) |
| 3033 | end | 3033 | end |
| 3034 | local _u1f31b = "月之脚本" | 3034 | local _u1f31b = "Skript des Mondes" |
| 3035 | _module_0["🌛"] = _u1f31b | 3035 | _module_0["🌛"] = _u1f31b |
| 3036 | return _module_0 | 3036 | return _module_0 |
| 3037 | local _module_0 = { } | 3037 | local _module_0 = { } |
| @@ -3042,16 +3042,16 @@ do | |||
| 3042 | end | 3042 | end |
| 3043 | local inventory = { | 3043 | local 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({ | |||
| 3109 | if (getmetatable(apple) ~= nil) then | 3109 | if (getmetatable(apple) ~= nil) then |
| 3110 | p(apple.size, apple.color, getmetatable(apple).__index) | 3110 | p(apple.size, apple.color, getmetatable(apple).__index) |
| 3111 | end | 3111 | end |
| 3112 | local _u1f31b = "月之脚本" | 3112 | local _u1f31b = "Skript des Mondes" |
| 3113 | _module_0["🌛"] = _u1f31b | 3113 | _module_0["🌛"] = _u1f31b |
| 3114 | return _module_0 | 3114 | return _module_0 |
| 3115 | local have_coins = false | 3115 | local have_coins = false |
| 3116 | if have_coins then | 3116 | if have_coins then |
| 3117 | print("Got coins") | 3117 | print("Münzen erhalten") |
| 3118 | else | 3118 | else |
| 3119 | print("No coins") | 3119 | print("Keine Münzen") |
| 3120 | end | 3120 | end |
| 3121 | local have_coins = false | 3121 | local have_coins = false |
| 3122 | if have_coins then | 3122 | if have_coins then |
| 3123 | print("Got coins") | 3123 | print("Münzen erhalten") |
| 3124 | else | 3124 | else |
| 3125 | print("No coins") | 3125 | print("Keine Münzen") |
| 3126 | end | 3126 | end |
| 3127 | local have_coins = false | 3127 | local have_coins = false |
| 3128 | print((function() | 3128 | print((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 |
| 3134 | end)()) | 3134 | end)()) |
| 3135 | local is_tall | 3135 | local is_tall |
| @@ -3142,20 +3142,20 @@ is_tall = function(name) | |||
| 3142 | end | 3142 | end |
| 3143 | local message | 3143 | local message |
| 3144 | if is_tall("Rob") then | 3144 | if is_tall("Rob") then |
| 3145 | message = "I am very tall" | 3145 | message = "Ich bin sehr groß" |
| 3146 | else | 3146 | else |
| 3147 | message = "I am not so tall" | 3147 | message = "Ich bin nicht so groß" |
| 3148 | end | 3148 | end |
| 3149 | print(message) | 3149 | print(message) |
| 3150 | if not (os.date("%A") == "Monday") then | 3150 | if not (os.date("%A") == "Monday") then |
| 3151 | print("it is not Monday!") | 3151 | print("Es ist nicht Montag!") |
| 3152 | end | 3152 | end |
| 3153 | if not (math.random() > 0.1) then | 3153 | if not (math.random() > 0.1) then |
| 3154 | print("You're lucky!") | 3154 | print("You're lucky!") |
| 3155 | end | 3155 | end |
| 3156 | local a = 5 | 3156 | local a = 5 |
| 3157 | if (1 == a or 3 == a or 5 == a or 7 == a) then | 3157 | if (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") |
| 3159 | end | 3159 | end |
| 3160 | if (function() | 3160 | if (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 |
| 3168 | end)() then | 3168 | end)() then |
| 3169 | print("checking if `a` is in a list") | 3169 | print("Prüfen, ob `a` in einer Liste ist") |
| 3170 | end | ||
| 3171 | if not (math.random() > 0.1) then | ||
| 3172 | print("You're lucky!") | ||
| 3173 | end | 3170 | end |
| 3174 | local have_coins = false | 3171 | local have_coins = false |
| 3175 | if have_coins then | 3172 | if have_coins then |
| 3176 | print("Got coins") | 3173 | print("Münzen erhalten") |
| 3177 | else | 3174 | else |
| 3178 | print("No coins") | 3175 | print("Keine Münzen") |
| 3179 | end | 3176 | end |
| 3180 | local have_coins = false | 3177 | local have_coins = false |
| 3181 | if have_coins then | 3178 | if have_coins then |
| 3182 | print("Got coins") | 3179 | print("Münzen erhalten") |
| 3183 | else | 3180 | else |
| 3184 | print("No coins") | 3181 | print("Keine Münzen") |
| 3185 | end | 3182 | end |
| 3186 | local have_coins = false | 3183 | local have_coins = false |
| 3187 | print((function() | 3184 | print((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 |
| 3193 | end)()) | 3190 | end)()) |
| 3194 | local is_tall | 3191 | local is_tall |
| @@ -3201,20 +3198,20 @@ is_tall = function(name) | |||
| 3201 | end | 3198 | end |
| 3202 | local message | 3199 | local message |
| 3203 | if is_tall("Rob") then | 3200 | if is_tall("Rob") then |
| 3204 | message = "I am very tall" | 3201 | message = "Ich bin sehr groß" |
| 3205 | else | 3202 | else |
| 3206 | message = "I am not so tall" | 3203 | message = "Ich bin nicht so groß" |
| 3207 | end | 3204 | end |
| 3208 | print(message) | 3205 | print(message) |
| 3209 | if not (os.date("%A") == "Monday") then | 3206 | if not (os.date("%A") == "Monday") then |
| 3210 | print("it is not Monday!") | 3207 | print("Es ist nicht Montag!") |
| 3211 | end | 3208 | end |
| 3212 | if not (math.random() > 0.1) then | 3209 | if not (math.random() > 0.1) then |
| 3213 | print("You're lucky!") | 3210 | print("You're lucky!") |
| 3214 | end | 3211 | end |
| 3215 | local a = 5 | 3212 | local a = 5 |
| 3216 | if (1 == a or 3 == a or 5 == a or 7 == a) then | 3213 | if (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") |
| 3218 | end | 3215 | end |
| 3219 | if (function() | 3216 | if (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 |
| 3227 | end)() then | 3224 | end)() then |
| 3228 | print("checking if `a` is in a list") | 3225 | print("Prüfen, ob `a` in einer Liste ist") |
| 3229 | end | ||
| 3230 | if not (math.random() > 0.1) then | ||
| 3231 | print("You're lucky!") | ||
| 3232 | end | 3226 | end |
| 3233 | for i = 10, 20 do | 3227 | for i = 10, 20 do |
| 3234 | print(i) | 3228 | print(i) |
| @@ -3420,11 +3414,11 @@ end | |||
| 3420 | odds = _accum_0 | 3414 | odds = _accum_0 |
| 3421 | local name = "Dan" | 3415 | local name = "Dan" |
| 3422 | if "Robert" == name then | 3416 | if "Robert" == name then |
| 3423 | print("You are Robert") | 3417 | print("Du bist Robert") |
| 3424 | elseif "Dan" == name or "Daniel" == name then | 3418 | elseif "Dan" == name or "Daniel" == name then |
| 3425 | print("Your name, it's Dan") | 3419 | print("Dein Name ist Dan") |
| 3426 | else | 3420 | else |
| 3427 | print("I don't know about you with name " .. tostring(name)) | 3421 | print("Ich kenne dich nicht mit dem Namen " .. tostring(name)) |
| 3428 | end | 3422 | end |
| 3429 | local b = 1 | 3423 | local b = 1 |
| 3430 | local next_number | 3424 | local next_number |
| @@ -3433,30 +3427,30 @@ if 1 == b then | |||
| 3433 | elseif 2 == b then | 3427 | elseif 2 == b then |
| 3434 | next_number = 3 | 3428 | next_number = 3 |
| 3435 | else | 3429 | else |
| 3436 | next_number = error("can't count that high!") | 3430 | next_number = error("so hoch kann ich nicht zählen!") |
| 3437 | end | 3431 | end |
| 3438 | local msg | 3432 | local msg |
| 3439 | local _exp_0 = math.random(1, 5) | 3433 | local _exp_0 = math.random(1, 5) |
| 3440 | if 1 == _exp_0 then | 3434 | if 1 == _exp_0 then |
| 3441 | msg = "you are lucky" | 3435 | msg = "Du hast Glück" |
| 3442 | elseif 2 == _exp_0 then | 3436 | elseif 2 == _exp_0 then |
| 3443 | msg = "you are almost lucky" | 3437 | msg = "Du hast fast Glück" |
| 3444 | else | 3438 | else |
| 3445 | msg = "not so lucky" | 3439 | msg = "nicht so viel Glück" |
| 3446 | end | 3440 | end |
| 3447 | do | 3441 | do |
| 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 |
| 3454 | end | 3448 | end |
| 3455 | local _exp_0 = math.random(1, 5) | 3449 | local _exp_0 = math.random(1, 5) |
| 3456 | if 1 == _exp_0 then | 3450 | if 1 == _exp_0 then |
| 3457 | print("you are lucky") | 3451 | print("Du hast Glück") |
| 3458 | else | 3452 | else |
| 3459 | print("not so lucky") | 3453 | print("nicht so viel Glück") |
| 3460 | end | 3454 | end |
| 3461 | local items = { | 3455 | local 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 |
| 3568 | end | 3562 | end |
| 3569 | if not _match_0 then | 3563 | if 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("ungültig") |
| 3579 | end | 3573 | end |
| 3580 | end | 3574 | end |
| 3581 | local _exp_0 = tb | 3575 | local _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 |
| 3605 | end | 3599 | end |
| 3606 | if not _match_0 then | 3600 | if 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("ungültig") |
| 3631 | end | 3625 | end |
| 3632 | end | 3626 | end |
| 3633 | local _exp_0 = tb | 3627 | local _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 |
| 3683 | end | 3677 | end |
| 3684 | local segments = { | 3678 | local 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 |
| 3712 | end | 3706 | end |
| 3713 | local name = "Dan" | 3707 | local name = "Dan" |
| 3714 | if "Robert" == name then | 3708 | if "Robert" == name then |
| 3715 | print("You are Robert") | 3709 | print("Du bist Robert") |
| 3716 | elseif "Dan" == name or "Daniel" == name then | 3710 | elseif "Dan" == name or "Daniel" == name then |
| 3717 | print("Your name, it's Dan") | 3711 | print("Dein Name ist Dan") |
| 3718 | else | 3712 | else |
| 3719 | print("I don't know about you with name " .. tostring(name)) | 3713 | print("Ich kenne dich nicht mit dem Namen " .. tostring(name)) |
| 3720 | end | 3714 | end |
| 3721 | local b = 1 | 3715 | local b = 1 |
| 3722 | local next_number | 3716 | local next_number |
| @@ -3725,30 +3719,30 @@ if 1 == b then | |||
| 3725 | elseif 2 == b then | 3719 | elseif 2 == b then |
| 3726 | next_number = 3 | 3720 | next_number = 3 |
| 3727 | else | 3721 | else |
| 3728 | next_number = error("can't count that high!") | 3722 | next_number = error("so hoch kann ich nicht zählen!") |
| 3729 | end | 3723 | end |
| 3730 | local msg | 3724 | local msg |
| 3731 | local _exp_0 = math.random(1, 5) | 3725 | local _exp_0 = math.random(1, 5) |
| 3732 | if 1 == _exp_0 then | 3726 | if 1 == _exp_0 then |
| 3733 | msg = "you are lucky" | 3727 | msg = "Du hast Glück" |
| 3734 | elseif 2 == _exp_0 then | 3728 | elseif 2 == _exp_0 then |
| 3735 | msg = "you are almost lucky" | 3729 | msg = "Du hast fast Glück" |
| 3736 | else | 3730 | else |
| 3737 | msg = "not so lucky" | 3731 | msg = "nicht so viel Glück" |
| 3738 | end | 3732 | end |
| 3739 | do | 3733 | do |
| 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 |
| 3746 | end | 3740 | end |
| 3747 | local _exp_0 = math.random(1, 5) | 3741 | local _exp_0 = math.random(1, 5) |
| 3748 | if 1 == _exp_0 then | 3742 | if 1 == _exp_0 then |
| 3749 | print("you are lucky") | 3743 | print("Du hast Glück") |
| 3750 | else | 3744 | else |
| 3751 | print("not so lucky") | 3745 | print("nicht so viel Glück") |
| 3752 | end | 3746 | end |
| 3753 | local items = { | 3747 | local 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 |
| 3860 | end | 3854 | end |
| 3861 | if not _match_0 then | 3855 | if 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("ungültig") |
| 3871 | end | 3865 | end |
| 3872 | end | 3866 | end |
| 3873 | local _exp_0 = tb | 3867 | local _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 |
| 3897 | end | 3891 | end |
| 3898 | if not _match_0 then | 3892 | if 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("ungültig") |
| 3923 | end | 3917 | end |
| 3924 | end | 3918 | end |
| 3925 | local _exp_0 = tb | 3919 | local _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 |
| 3975 | end | 3969 | end |
| 3976 | local segments = { | 3970 | local 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 |
| 4004 | end | 3998 | end |
| 4005 | local i = 10 | 3999 | local i = 10 |
| @@ -4047,12 +4041,12 @@ until i == 0 | |||
| 4047 | local my_object = { | 4041 | local 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 | } |
| 4053 | local run_callback | 4047 | local run_callback |
| 4054 | run_callback = function(func) | 4048 | run_callback = function(func) |
| 4055 | print("running callback...") | 4049 | print("Callback wird ausgeführt...") |
| 4056 | return func() | 4050 | return func() |
| 4057 | end | 4051 | end |
| 4058 | run_callback(my_object.write) | 4052 | run_callback(my_object.write) |
| @@ -4066,12 +4060,12 @@ end)()) | |||
| 4066 | local my_object = { | 4060 | local 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 | } |
| 4072 | local run_callback | 4066 | local run_callback |
| 4073 | run_callback = function(func) | 4067 | run_callback = function(func) |
| 4074 | print("running callback...") | 4068 | print("Callback wird ausgeführt...") |
| 4075 | return func() | 4069 | return func() |
| 4076 | end | 4070 | end |
| 4077 | run_callback(my_object.write) | 4071 | run_callback(my_object.write) |
| @@ -4083,7 +4077,7 @@ run_callback((function() | |||
| 4083 | end | 4077 | end |
| 4084 | end)()) | 4078 | end)()) |
| 4085 | f(function(x) | 4079 | f(function(x) |
| 4086 | return print("hello" .. x) | 4080 | return print("hallo" .. x) |
| 4087 | end) | 4081 | end) |
| 4088 | f(function(self) | 4082 | f(function(self) |
| 4089 | return print(self.value) | 4083 | return print(self.value) |
| @@ -4097,7 +4091,7 @@ end, { | |||
| 4097 | }) | 4091 | }) |
| 4098 | local result, msg | 4092 | local result, msg |
| 4099 | do | 4093 | do |
| 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 | |||
| 4106 | end | 4100 | end |
| 4107 | print(result, msg) | 4101 | print(result, msg) |
| 4108 | f(function(x) | 4102 | f(function(x) |
| 4109 | return print("hello" .. x) | 4103 | return print("hallo" .. x) |
| 4110 | end) | 4104 | end) |
| 4111 | f(function(self) | 4105 | f(function(self) |
| 4112 | return print(self.value) | 4106 | return print(self.value) |
| @@ -4120,7 +4114,7 @@ end, { | |||
| 4120 | }) | 4114 | }) |
| 4121 | local result, msg | 4115 | local result, msg |
| 4122 | do | 4116 | do |
| 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 | |||
| 4133 | my_function() | 4127 | my_function() |
| 4134 | local func_a | 4128 | local func_a |
| 4135 | func_a = function() | 4129 | func_a = function() |
| 4136 | return print("hello world") | 4130 | return print("Hallo Welt") |
| 4137 | end | 4131 | end |
| 4138 | local func_b | 4132 | local func_b |
| 4139 | func_b = function() | 4133 | func_b = function() |
| 4140 | local value = 100 | 4134 | local value = 100 |
| 4141 | return print("The value:", value) | 4135 | return print("Der Wert:", value) |
| 4142 | end | 4136 | end |
| 4143 | func_a() | 4137 | func_a() |
| 4144 | func_b() | 4138 | func_b() |
| 4145 | local sum | 4139 | local sum |
| 4146 | sum = function(x, y) | 4140 | sum = function(x, y) |
| 4147 | return print("sum", x + y) | 4141 | return print("Summe", x + y) |
| 4148 | end | 4142 | end |
| 4149 | sum(10, 20) | 4143 | sum(10, 20) |
| 4150 | print(sum(10, 20)) | 4144 | print(sum(10, 20)) |
| @@ -4154,7 +4148,7 @@ local sum | |||
| 4154 | sum = function(x, y) | 4148 | sum = function(x, y) |
| 4155 | return x + y | 4149 | return x + y |
| 4156 | end | 4150 | end |
| 4157 | print("The sum is ", sum(10, 20)) | 4151 | print("Die Summe ist ", sum(10, 20)) |
| 4158 | local sum | 4152 | local sum |
| 4159 | sum = function(x, y) | 4153 | sum = function(x, y) |
| 4160 | return x + y | 4154 | return x + y |
| @@ -4171,13 +4165,13 @@ end | |||
| 4171 | local my_function | 4165 | local my_function |
| 4172 | my_function = function(name, height) | 4166 | my_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) |
| 4181 | end | 4175 | end |
| 4182 | local some_args | 4176 | local some_args |
| 4183 | some_args = function(x, y) | 4177 | some_args = function(x, y) |
| @@ -4193,8 +4187,8 @@ local a = x - 10 | |||
| 4193 | local b = x - 10 | 4187 | local b = x - 10 |
| 4194 | local c = x(-y) | 4188 | local c = x(-y) |
| 4195 | local d = x - z | 4189 | local d = x - z |
| 4196 | local x = func("hello") + 100 | 4190 | local x = func("hallo") + 100 |
| 4197 | local y = func("hello" + 100) | 4191 | local y = func("hallo" + 100) |
| 4198 | my_func(5, 4, 3, 8, 9, 10) | 4192 | my_func(5, 4, 3, 8, 9, 10) |
| 4199 | cool_func(1, 2, 3, 4, 5, 6, 7, 8) | 4193 | cool_func(1, 2, 3, 4, 5, 6, 7, 8) |
| 4200 | my_func(5, 6, 7, 6, another_func(6, 7, 8, 9, 1, 2), 5, 4) | 4194 | my_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 | } |
| 4217 | if func(1, 2, 3, "hello", "world") then | 4211 | if 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") |
| 4220 | end | 4214 | end |
| 4221 | if func(1, 2, 3, "hello", "world") then | 4215 | if 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") |
| 4224 | end | 4218 | end |
| 4225 | local f1 | 4219 | local f1 |
| 4226 | f1 = function(_arg_0) | 4220 | f1 = 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 | |||
| 4317 | my_function() | 4311 | my_function() |
| 4318 | local func_a | 4312 | local func_a |
| 4319 | func_a = function() | 4313 | func_a = function() |
| 4320 | return print("hello world") | 4314 | return print("Hallo Welt") |
| 4321 | end | 4315 | end |
| 4322 | local func_b | 4316 | local func_b |
| 4323 | func_b = function() | 4317 | func_b = function() |
| 4324 | local value = 100 | 4318 | local value = 100 |
| 4325 | return print("The value:", value) | 4319 | return print("Der Wert:", value) |
| 4326 | end | 4320 | end |
| 4327 | func_a() | 4321 | func_a() |
| 4328 | func_b() | 4322 | func_b() |
| 4329 | local sum | 4323 | local sum |
| 4330 | sum = function(x, y) | 4324 | sum = function(x, y) |
| 4331 | return print("sum", x + y) | 4325 | return print("Summe", x + y) |
| 4332 | end | 4326 | end |
| 4333 | sum(10, 20) | 4327 | sum(10, 20) |
| 4334 | print(sum(10, 20)) | 4328 | print(sum(10, 20)) |
| @@ -4338,7 +4332,7 @@ local sum | |||
| 4338 | sum = function(x, y) | 4332 | sum = function(x, y) |
| 4339 | return x + y | 4333 | return x + y |
| 4340 | end | 4334 | end |
| 4341 | print("The sum is ", sum(10, 20)) | 4335 | print("Die Summe ist ", sum(10, 20)) |
| 4342 | local sum | 4336 | local sum |
| 4343 | sum = function(x, y) | 4337 | sum = function(x, y) |
| 4344 | return x + y | 4338 | return x + y |
| @@ -4355,13 +4349,13 @@ end | |||
| 4355 | local my_function | 4349 | local my_function |
| 4356 | my_function = function(name, height) | 4350 | my_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) |
| 4365 | end | 4359 | end |
| 4366 | local some_args | 4360 | local some_args |
| 4367 | some_args = function(x, y) | 4361 | some_args = function(x, y) |
| @@ -4377,8 +4371,8 @@ local a = x - 10 | |||
| 4377 | local b = x - 10 | 4371 | local b = x - 10 |
| 4378 | local c = x(-y) | 4372 | local c = x(-y) |
| 4379 | local d = x - z | 4373 | local d = x - z |
| 4380 | local x = func("hello") + 100 | 4374 | local x = func("hallo") + 100 |
| 4381 | local y = func("hello" + 100) | 4375 | local y = func("hallo" + 100) |
| 4382 | my_func(5, 4, 3, 8, 9, 10) | 4376 | my_func(5, 4, 3, 8, 9, 10) |
| 4383 | cool_func(1, 2, 3, 4, 5, 6, 7, 8) | 4377 | cool_func(1, 2, 3, 4, 5, 6, 7, 8) |
| 4384 | my_func(5, 6, 7, 6, another_func(6, 7, 8, 9, 1, 2), 5, 4) | 4378 | my_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 | } |
| 4401 | if func(1, 2, 3, "hello", "world") then | 4395 | if 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") |
| 4404 | end | 4398 | end |
| 4405 | if func(1, 2, 3, "hello", "world") then | 4399 | if 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") |
| 4408 | end | 4402 | end |
| 4409 | local f1 | 4403 | local f1 |
| 4410 | f1 = function(_arg_0) | 4404 | f1 = 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") | |||
| 4519 | local a <const> = 123 | 4513 | local a <const> = 123 |
| 4520 | local _ <close> = setmetatable({ }, { | 4514 | local _ <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 | }) |
| 4525 | local a, b, c, d | 4519 | local a, b, c, d |
| @@ -4529,7 +4523,7 @@ Constant = 123 | |||
| 4529 | local a <const> = 123 | 4523 | local a <const> = 123 |
| 4530 | local _ <close> = setmetatable({ }, { | 4524 | local _ <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 | }) |
| 4535 | local a, b, c, d | 4529 | local a, b, c, d |
| @@ -4567,7 +4561,7 @@ print((function() | |||
| 4567 | end | 4561 | end |
| 4568 | end)()) | 4562 | end)()) |
| 4569 | local tab = { } | 4563 | local tab = { } |
| 4570 | tab[#tab + 1] = "Value" | 4564 | tab[#tab + 1] = "Wert" |
| 4571 | local tbA = { | 4565 | local 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 |
| 4585 | end | 4579 | end |
| 4586 | local parts = { | 4580 | local parts = { |
| 4587 | "shoulders", | 4581 | "Schultern", |
| 4588 | "knees" | 4582 | "Knie" |
| 4589 | } | 4583 | } |
| 4590 | local lyrics | 4584 | local lyrics |
| 4591 | do | 4585 | do |
| 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 |
| 4607 | end | 4601 | end |
| 4608 | local copy | 4602 | local copy |
| @@ -4688,7 +4682,7 @@ local d = a + b + c | |||
| 4688 | print(d.value) | 4682 | print(d.value) |
| 4689 | local _ <close> = setmetatable({ }, { | 4683 | local _ <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 | }) |
| 4694 | local tb = setmetatable({ }, { | 4688 | local tb = setmetatable({ }, { |
| @@ -4698,7 +4692,7 @@ getmetatable(tb).__index = getmetatable(tb) | |||
| 4698 | print(tb.value) | 4692 | print(tb.value) |
| 4699 | setmetatable(tb, { | 4693 | setmetatable(tb, { |
| 4700 | __index = { | 4694 | __index = { |
| 4701 | item = "hello" | 4695 | item = "hallo" |
| 4702 | } | 4696 | } |
| 4703 | }) | 4697 | }) |
| 4704 | print(tb.item) | 4698 | print(tb.item) |
| @@ -4860,7 +4854,7 @@ print((function() | |||
| 4860 | end | 4854 | end |
| 4861 | end)()) | 4855 | end)()) |
| 4862 | local tab = { } | 4856 | local tab = { } |
| 4863 | tab[#tab + 1] = "Value" | 4857 | tab[#tab + 1] = "Wert" |
| 4864 | local tbA = { | 4858 | local 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 |
| 4878 | end | 4872 | end |
| 4879 | local parts = { | 4873 | local parts = { |
| 4880 | "shoulders", | 4874 | "Schultern", |
| 4881 | "knees" | 4875 | "Knie" |
| 4882 | } | 4876 | } |
| 4883 | local lyrics | 4877 | local lyrics |
| 4884 | do | 4878 | do |
| 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 |
| 4900 | end | 4894 | end |
| 4901 | local copy | 4895 | local copy |
| @@ -4981,7 +4975,7 @@ local d = a + b + c | |||
| 4981 | print(d.value) | 4975 | print(d.value) |
| 4982 | local _ <close> = setmetatable({ }, { | 4976 | local _ <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 | }) |
| 4987 | local tb = setmetatable({ }, { | 4981 | local tb = setmetatable({ }, { |
| @@ -4991,7 +4985,7 @@ getmetatable(tb).__index = getmetatable(tb) | |||
| 4991 | print(tb.value) | 4985 | print(tb.value) |
| 4992 | setmetatable(tb, { | 4986 | setmetatable(tb, { |
| 4993 | __index = { | 4987 | __index = { |
| 4994 | item = "hello" | 4988 | item = "hallo" |
| 4995 | } | 4989 | } |
| 4996 | }) | 4990 | }) |
| 4997 | print(tb.item) | 4991 | print(tb.item) |
| @@ -5122,8 +5116,8 @@ local tb = { | |||
| 5122 | } | 5116 | } |
| 5123 | } | 5117 | } |
| 5124 | } | 5118 | } |
| 5125 | local some_string = "Here is a string\n that has a line break in it." | 5119 | local some_string = "Hier ist ein String\n mit einem Zeilenumbruch." |
| 5126 | print("I am " .. tostring(math.random() * 100) .. "% sure.") | 5120 | print("Ich bin mir zu " .. tostring(math.random() * 100) .. "% sicher.") |
| 5127 | local integer = 1000000 | 5121 | local integer = 1000000 |
| 5128 | local hex = 0xEFBBBF | 5122 | local hex = 0xEFBBBF |
| 5129 | local binary = 19 | 5123 | local binary = 19 |
| @@ -5134,8 +5128,8 @@ fn = function() | |||
| 5134 | return str | 5128 | return str |
| 5135 | end | 5129 | end |
| 5136 | local str = "path: \"C:\\Program Files\\App\"\nnote: 'He said: \"" .. tostring(Hello) .. "!\"'" | 5130 | local str = "path: \"C:\\Program Files\\App\"\nnote: 'He said: \"" .. tostring(Hello) .. "!\"'" |
| 5137 | local some_string = "Here is a string\n that has a line break in it." | 5131 | local some_string = "Hier ist ein String\n mit einem Zeilenumbruch." |
| 5138 | print("I am " .. tostring(math.random() * 100) .. "% sure.") | 5132 | print("Ich bin mir zu " .. tostring(math.random() * 100) .. "% sicher.") |
| 5139 | local integer = 1000000 | 5133 | local integer = 1000000 |
| 5140 | local hex = 0xEFBBBF | 5134 | local hex = 0xEFBBBF |
| 5141 | local binary = 19 | 5135 | local 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({ | |||
| 3031 | if (getmetatable(apple) ~= nil) then | 3031 | if (getmetatable(apple) ~= nil) then |
| 3032 | p(apple.size, apple.color, getmetatable(apple).__index) | 3032 | p(apple.size, apple.color, getmetatable(apple).__index) |
| 3033 | end | 3033 | end |
| 3034 | local _u1f31b = "月之脚本" | 3034 | local _u1f31b = "Script of Moon" |
| 3035 | _module_0["🌛"] = _u1f31b | 3035 | _module_0["🌛"] = _u1f31b |
| 3036 | return _module_0 | 3036 | return _module_0 |
| 3037 | local _module_0 = { } | 3037 | local _module_0 = { } |
| @@ -3109,7 +3109,7 @@ local apple = setmetatable({ | |||
| 3109 | if (getmetatable(apple) ~= nil) then | 3109 | if (getmetatable(apple) ~= nil) then |
| 3110 | p(apple.size, apple.color, getmetatable(apple).__index) | 3110 | p(apple.size, apple.color, getmetatable(apple).__index) |
| 3111 | end | 3111 | end |
| 3112 | local _u1f31b = "月之脚本" | 3112 | local _u1f31b = "Script of Moon" |
| 3113 | _module_0["🌛"] = _u1f31b | 3113 | _module_0["🌛"] = _u1f31b |
| 3114 | return _module_0 | 3114 | return _module_0 |
| 3115 | local have_coins = false | 3115 | local have_coins = false |
| @@ -3168,9 +3168,6 @@ if (function() | |||
| 3168 | end)() then | 3168 | end)() then |
| 3169 | print("checking if `a` is in a list") | 3169 | print("checking if `a` is in a list") |
| 3170 | end | 3170 | end |
| 3171 | if not (math.random() > 0.1) then | ||
| 3172 | print("You're lucky!") | ||
| 3173 | end | ||
| 3174 | local have_coins = false | 3171 | local have_coins = false |
| 3175 | if have_coins then | 3172 | if have_coins then |
| 3176 | print("Got coins") | 3173 | print("Got coins") |
| @@ -3227,9 +3224,6 @@ if (function() | |||
| 3227 | end)() then | 3224 | end)() then |
| 3228 | print("checking if `a` is in a list") | 3225 | print("checking if `a` is in a list") |
| 3229 | end | 3226 | end |
| 3230 | if not (math.random() > 0.1) then | ||
| 3231 | print("You're lucky!") | ||
| 3232 | end | ||
| 3233 | for i = 10, 20 do | 3227 | for i = 10, 20 do |
| 3234 | print(i) | 3228 | print(i) |
| 3235 | end | 3229 | end |
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 | |||
| 83 | end | 83 | end |
| 84 | local funcA | 84 | local funcA |
| 85 | funcA = function() | 85 | funcA = function() |
| 86 | return "fail to assign to the Yue macro defined variable" | 86 | return "gagal meng-assign ke variabel yang didefinisikan oleh macro Yue" |
| 87 | end | 87 | end |
| 88 | do | 88 | do |
| 89 | local function funcB() end | 89 | local function funcB() end |
| 90 | end | 90 | end |
| 91 | local funcB | 91 | local funcB |
| 92 | funcB = function() | 92 | funcB = function() |
| 93 | return "fail to assign to the Lua macro defined variable" | 93 | return "gagal meng-assign ke variabel yang didefinisikan oleh macro Lua" |
| 94 | end | 94 | end |
| 95 | do | 95 | do |
| 96 | -- raw Lua codes insertion | 96 | -- penyisipan kode Lua mentah |
| 97 | if cond then | 97 | if cond then |
| 98 | print("output") | 98 | print("output") |
| 99 | end | 99 | end |
| @@ -122,17 +122,17 @@ do | |||
| 122 | end | 122 | end |
| 123 | local funcA | 123 | local funcA |
| 124 | funcA = function() | 124 | funcA = function() |
| 125 | return "fail to assign to the Yue macro defined variable" | 125 | return "gagal meng-assign ke variabel yang didefinisikan oleh macro Yue" |
| 126 | end | 126 | end |
| 127 | do | 127 | do |
| 128 | local function funcB() end | 128 | local function funcB() end |
| 129 | end | 129 | end |
| 130 | local funcB | 130 | local funcB |
| 131 | funcB = function() | 131 | funcB = function() |
| 132 | return "fail to assign to the Lua macro defined variable" | 132 | return "gagal meng-assign ke variabel yang didefinisikan oleh macro Lua" |
| 133 | end | 133 | end |
| 134 | do | 134 | do |
| 135 | -- raw Lua codes insertion | 135 | -- penyisipan kode Lua mentah |
| 136 | if cond then | 136 | if cond then |
| 137 | print("output") | 137 | print("output") |
| 138 | end | 138 | end |
| @@ -2488,7 +2488,7 @@ local z = x | |||
| 2488 | do | 2488 | do |
| 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 | |||
| 2498 | do | 2498 | do |
| 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 |
| 2504 | end | 2504 | end |
| 2505 | do | 2505 | do |
| 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 | |||
| 2512 | end | 2512 | end |
| 2513 | do | 2513 | do |
| 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 | |||
| 2539 | do | 2539 | do |
| 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 | |||
| 2549 | do | 2549 | do |
| 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 |
| 2555 | end | 2555 | end |
| 2556 | do | 2556 | do |
| 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 | |||
| 2563 | end | 2563 | end |
| 2564 | do | 2564 | do |
| 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({ | |||
| 3031 | if (getmetatable(apple) ~= nil) then | 3031 | if (getmetatable(apple) ~= nil) then |
| 3032 | p(apple.size, apple.color, getmetatable(apple).__index) | 3032 | p(apple.size, apple.color, getmetatable(apple).__index) |
| 3033 | end | 3033 | end |
| 3034 | local _u1f31b = "月之脚本" | 3034 | local _u1f31b = "Skrip Bulan" |
| 3035 | _module_0["🌛"] = _u1f31b | 3035 | _module_0["🌛"] = _u1f31b |
| 3036 | return _module_0 | 3036 | return _module_0 |
| 3037 | local _module_0 = { } | 3037 | local _module_0 = { } |
| @@ -3109,27 +3109,27 @@ local apple = setmetatable({ | |||
| 3109 | if (getmetatable(apple) ~= nil) then | 3109 | if (getmetatable(apple) ~= nil) then |
| 3110 | p(apple.size, apple.color, getmetatable(apple).__index) | 3110 | p(apple.size, apple.color, getmetatable(apple).__index) |
| 3111 | end | 3111 | end |
| 3112 | local _u1f31b = "月之脚本" | 3112 | local _u1f31b = "Skrip Bulan" |
| 3113 | _module_0["🌛"] = _u1f31b | 3113 | _module_0["🌛"] = _u1f31b |
| 3114 | return _module_0 | 3114 | return _module_0 |
| 3115 | local have_coins = false | 3115 | local have_coins = false |
| 3116 | if have_coins then | 3116 | if have_coins then |
| 3117 | print("Got coins") | 3117 | print("Dapat koin") |
| 3118 | else | 3118 | else |
| 3119 | print("No coins") | 3119 | print("Tidak ada koin") |
| 3120 | end | 3120 | end |
| 3121 | local have_coins = false | 3121 | local have_coins = false |
| 3122 | if have_coins then | 3122 | if have_coins then |
| 3123 | print("Got coins") | 3123 | print("Dapat koin") |
| 3124 | else | 3124 | else |
| 3125 | print("No coins") | 3125 | print("Tidak ada koin") |
| 3126 | end | 3126 | end |
| 3127 | local have_coins = false | 3127 | local have_coins = false |
| 3128 | print((function() | 3128 | print((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 |
| 3134 | end)()) | 3134 | end)()) |
| 3135 | local is_tall | 3135 | local is_tall |
| @@ -3142,20 +3142,20 @@ is_tall = function(name) | |||
| 3142 | end | 3142 | end |
| 3143 | local message | 3143 | local message |
| 3144 | if is_tall("Rob") then | 3144 | if is_tall("Rob") then |
| 3145 | message = "I am very tall" | 3145 | message = "Saya sangat tinggi" |
| 3146 | else | 3146 | else |
| 3147 | message = "I am not so tall" | 3147 | message = "Saya tidak terlalu tinggi" |
| 3148 | end | 3148 | end |
| 3149 | print(message) | 3149 | print(message) |
| 3150 | if not (os.date("%A") == "Monday") then | 3150 | if not (os.date("%A") == "Monday") then |
| 3151 | print("it is not Monday!") | 3151 | print("hari ini bukan Senin!") |
| 3152 | end | 3152 | end |
| 3153 | if not (math.random() > 0.1) then | 3153 | if not (math.random() > 0.1) then |
| 3154 | print("You're lucky!") | 3154 | print("Kamu beruntung!") |
| 3155 | end | 3155 | end |
| 3156 | local a = 5 | 3156 | local a = 5 |
| 3157 | if (1 == a or 3 == a or 5 == a or 7 == a) then | 3157 | if (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") |
| 3159 | end | 3159 | end |
| 3160 | if (function() | 3160 | if (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 |
| 3168 | end)() then | 3168 | end)() then |
| 3169 | print("checking if `a` is in a list") | 3169 | print("memeriksa apakah `a` ada di dalam daftar") |
| 3170 | end | ||
| 3171 | if not (math.random() > 0.1) then | ||
| 3172 | print("You're lucky!") | ||
| 3173 | end | 3170 | end |
| 3174 | local have_coins = false | 3171 | local have_coins = false |
| 3175 | if have_coins then | 3172 | if have_coins then |
| 3176 | print("Got coins") | 3173 | print("Dapat koin") |
| 3177 | else | 3174 | else |
| 3178 | print("No coins") | 3175 | print("Tidak ada koin") |
| 3179 | end | 3176 | end |
| 3180 | local have_coins = false | 3177 | local have_coins = false |
| 3181 | if have_coins then | 3178 | if have_coins then |
| 3182 | print("Got coins") | 3179 | print("Dapat koin") |
| 3183 | else | 3180 | else |
| 3184 | print("No coins") | 3181 | print("Tidak ada koin") |
| 3185 | end | 3182 | end |
| 3186 | local have_coins = false | 3183 | local have_coins = false |
| 3187 | print((function() | 3184 | print((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 |
| 3193 | end)()) | 3190 | end)()) |
| 3194 | local is_tall | 3191 | local is_tall |
| @@ -3201,20 +3198,20 @@ is_tall = function(name) | |||
| 3201 | end | 3198 | end |
| 3202 | local message | 3199 | local message |
| 3203 | if is_tall("Rob") then | 3200 | if is_tall("Rob") then |
| 3204 | message = "I am very tall" | 3201 | message = "Saya sangat tinggi" |
| 3205 | else | 3202 | else |
| 3206 | message = "I am not so tall" | 3203 | message = "Saya tidak terlalu tinggi" |
| 3207 | end | 3204 | end |
| 3208 | print(message) | 3205 | print(message) |
| 3209 | if not (os.date("%A") == "Monday") then | 3206 | if not (os.date("%A") == "Monday") then |
| 3210 | print("it is not Monday!") | 3207 | print("hari ini bukan Senin!") |
| 3211 | end | 3208 | end |
| 3212 | if not (math.random() > 0.1) then | 3209 | if not (math.random() > 0.1) then |
| 3213 | print("You're lucky!") | 3210 | print("Kamu beruntung!") |
| 3214 | end | 3211 | end |
| 3215 | local a = 5 | 3212 | local a = 5 |
| 3216 | if (1 == a or 3 == a or 5 == a or 7 == a) then | 3213 | if (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") |
| 3218 | end | 3215 | end |
| 3219 | if (function() | 3216 | if (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 |
| 3227 | end)() then | 3224 | end)() then |
| 3228 | print("checking if `a` is in a list") | 3225 | print("memeriksa apakah `a` ada di dalam daftar") |
| 3229 | end | ||
| 3230 | if not (math.random() > 0.1) then | ||
| 3231 | print("You're lucky!") | ||
| 3232 | end | 3226 | end |
| 3233 | for i = 10, 20 do | 3227 | for 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" |
| 94 | end | 94 | end |
| 95 | do | 95 | do |
| 96 | -- raw Lua codes insertion | 96 | -- inserção de códigos Lua brutos |
| 97 | if cond then | 97 | if cond then |
| 98 | print("output") | 98 | print("output") |
| 99 | end | 99 | end |
| @@ -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" |
| 133 | end | 133 | end |
| 134 | do | 134 | do |
| 135 | -- raw Lua codes insertion | 135 | -- inserção de códigos Lua brutos |
| 136 | if cond then | 136 | if cond then |
| 137 | print("output") | 137 | print("output") |
| 138 | end | 138 | end |
| @@ -2476,7 +2476,7 @@ x = x * 10 | |||
| 2476 | x = x / 10 | 2476 | x = x / 10 |
| 2477 | x = x % 10 | 2477 | x = x % 10 |
| 2478 | local s = s .. "world" | 2478 | local s = s .. "world" |
| 2479 | local arg = arg or "default value" | 2479 | local arg = arg or "valor padrão" |
| 2480 | local a = 0 | 2480 | local a = 0 |
| 2481 | local b = 0 | 2481 | local b = 0 |
| 2482 | local c = 0 | 2482 | local c = 0 |
| @@ -2488,7 +2488,7 @@ local z = x | |||
| 2488 | do | 2488 | do |
| 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 | |||
| 2498 | do | 2498 | do |
| 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 |
| 2504 | end | 2504 | end |
| 2505 | do | 2505 | do |
| 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 | |||
| 2512 | end | 2512 | end |
| 2513 | do | 2513 | do |
| 2514 | X = 1 | 2514 | X = 1 |
| 2515 | print("only declare upper case variables as globals") | 2515 | print("declarar apenas variáveis em maiúsculas 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" |
| 2519 | end | 2519 | end |
| 2520 | local hello = "world" | 2520 | local hello = "world" |
| 2521 | local a, b, c = 1, 2, 3 | 2521 | local a, b, c = 1, 2, 3 |
| @@ -2527,7 +2527,7 @@ x = x * 10 | |||
| 2527 | x = x / 10 | 2527 | x = x / 10 |
| 2528 | x = x % 10 | 2528 | x = x % 10 |
| 2529 | local s = s .. "world" | 2529 | local s = s .. "world" |
| 2530 | local arg = arg or "default value" | 2530 | local arg = arg or "valor padrão" |
| 2531 | local a = 0 | 2531 | local a = 0 |
| 2532 | local b = 0 | 2532 | local b = 0 |
| 2533 | local c = 0 | 2533 | local c = 0 |
| @@ -2539,7 +2539,7 @@ local z = x | |||
| 2539 | do | 2539 | do |
| 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 | |||
| 2549 | do | 2549 | do |
| 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 |
| 2555 | end | 2555 | end |
| 2556 | do | 2556 | do |
| 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 | |||
| 2563 | end | 2563 | end |
| 2564 | do | 2564 | do |
| 2565 | X = 1 | 2565 | X = 1 |
| 2566 | print("only declare upper case variables as globals") | 2566 | print("declarar apenas variáveis em maiúsculas 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" |
| 2570 | end | 2570 | end |
| 2571 | local list = { | 2571 | local list = { |
| 2572 | 1, | 2572 | 1, |
| @@ -2608,18 +2608,18 @@ if user then | |||
| 2608 | end | 2608 | end |
| 2609 | local hello = os.getenv("hello") | 2609 | local hello = os.getenv("hello") |
| 2610 | if hello then | 2610 | if hello then |
| 2611 | print("You have hello", hello) | 2611 | print("Você tem hello", hello) |
| 2612 | else | 2612 | else |
| 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("você tem world", world) |
| 2616 | else | 2616 | else |
| 2617 | print("nothing :(") | 2617 | print("nada :(") |
| 2618 | end | 2618 | end |
| 2619 | end | 2619 | end |
| 2620 | do | 2620 | do |
| 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 | |||
| 2640 | end | 2640 | end |
| 2641 | local hello = os.getenv("hello") | 2641 | local hello = os.getenv("hello") |
| 2642 | if hello then | 2642 | if hello then |
| 2643 | print("You have hello", hello) | 2643 | print("Você tem hello", hello) |
| 2644 | else | 2644 | else |
| 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("você tem world", world) |
| 2648 | else | 2648 | else |
| 2649 | print("nothing :(") | 2649 | print("nada :(") |
| 2650 | end | 2650 | end |
| 2651 | end | 2651 | end |
| 2652 | do | 2652 | do |
| 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 | |||
| 2707 | local _obj_0 = person | 2707 | local _obj_0 = person |
| 2708 | name, job = _obj_0.name, _obj_0.job | 2708 | name, job = _obj_0.name, _obj_0.job |
| 2709 | if name == nil then | 2709 | if name == nil then |
| 2710 | name = "nameless" | 2710 | name = "sem nome" |
| 2711 | end | 2711 | end |
| 2712 | if job == nil then | 2712 | if job == nil then |
| 2713 | job = "jobless" | 2713 | job = "sem emprego" |
| 2714 | end | 2714 | end |
| 2715 | local two, four | 2715 | local two, four |
| 2716 | local _obj_0 = items | 2716 | local _obj_0 = items |
| @@ -2824,10 +2824,10 @@ local name, job | |||
| 2824 | local _obj_0 = person | 2824 | local _obj_0 = person |
| 2825 | name, job = _obj_0.name, _obj_0.job | 2825 | name, job = _obj_0.name, _obj_0.job |
| 2826 | if name == nil then | 2826 | if name == nil then |
| 2827 | name = "nameless" | 2827 | name = "sem nome" |
| 2828 | end | 2828 | end |
| 2829 | if job == nil then | 2829 | if job == nil then |
| 2830 | job = "jobless" | 2830 | job = "sem emprego" |
| 2831 | end | 2831 | end |
| 2832 | local two, four | 2832 | local two, four |
| 2833 | local _obj_0 = items | 2833 | local _obj_0 = items |
| @@ -3031,7 +3031,7 @@ local apple = setmetatable({ | |||
| 3031 | if (getmetatable(apple) ~= nil) then | 3031 | if (getmetatable(apple) ~= nil) then |
| 3032 | p(apple.size, apple.color, getmetatable(apple).__index) | 3032 | p(apple.size, apple.color, getmetatable(apple).__index) |
| 3033 | end | 3033 | end |
| 3034 | local _u1f31b = "月之脚本" | 3034 | local _u1f31b = "Script da Lua" |
| 3035 | _module_0["🌛"] = _u1f31b | 3035 | _module_0["🌛"] = _u1f31b |
| 3036 | return _module_0 | 3036 | return _module_0 |
| 3037 | local _module_0 = { } | 3037 | local _module_0 = { } |
| @@ -3109,27 +3109,27 @@ local apple = setmetatable({ | |||
| 3109 | if (getmetatable(apple) ~= nil) then | 3109 | if (getmetatable(apple) ~= nil) then |
| 3110 | p(apple.size, apple.color, getmetatable(apple).__index) | 3110 | p(apple.size, apple.color, getmetatable(apple).__index) |
| 3111 | end | 3111 | end |
| 3112 | local _u1f31b = "月之脚本" | 3112 | local _u1f31b = "Script da Lua" |
| 3113 | _module_0["🌛"] = _u1f31b | 3113 | _module_0["🌛"] = _u1f31b |
| 3114 | return _module_0 | 3114 | return _module_0 |
| 3115 | local have_coins = false | 3115 | local have_coins = false |
| 3116 | if have_coins then | 3116 | if have_coins then |
| 3117 | print("Got coins") | 3117 | print("Tem moedas") |
| 3118 | else | 3118 | else |
| 3119 | print("No coins") | 3119 | print("Sem moedas") |
| 3120 | end | 3120 | end |
| 3121 | local have_coins = false | 3121 | local have_coins = false |
| 3122 | if have_coins then | 3122 | if have_coins then |
| 3123 | print("Got coins") | 3123 | print("Tem moedas") |
| 3124 | else | 3124 | else |
| 3125 | print("No coins") | 3125 | print("Sem moedas") |
| 3126 | end | 3126 | end |
| 3127 | local have_coins = false | 3127 | local have_coins = false |
| 3128 | print((function() | 3128 | print((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 |
| 3134 | end)()) | 3134 | end)()) |
| 3135 | local is_tall | 3135 | local is_tall |
| @@ -3142,20 +3142,20 @@ is_tall = function(name) | |||
| 3142 | end | 3142 | end |
| 3143 | local message | 3143 | local message |
| 3144 | if is_tall("Rob") then | 3144 | if is_tall("Rob") then |
| 3145 | message = "I am very tall" | 3145 | message = "Sou muito alto" |
| 3146 | else | 3146 | else |
| 3147 | message = "I am not so tall" | 3147 | message = "Não sou tão alto" |
| 3148 | end | 3148 | end |
| 3149 | print(message) | 3149 | print(message) |
| 3150 | if not (os.date("%A") == "Monday") then | 3150 | if not (os.date("%A") == "Monday") then |
| 3151 | print("it is not Monday!") | 3151 | print("não é segunda-feira!") |
| 3152 | end | 3152 | end |
| 3153 | if not (math.random() > 0.1) then | 3153 | if not (math.random() > 0.1) then |
| 3154 | print("You're lucky!") | 3154 | print("Você tem sorte!") |
| 3155 | end | 3155 | end |
| 3156 | local a = 5 | 3156 | local a = 5 |
| 3157 | if (1 == a or 3 == a or 5 == a or 7 == a) then | 3157 | if (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") |
| 3159 | end | 3159 | end |
| 3160 | if (function() | 3160 | if (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 |
| 3168 | end)() then | 3168 | end)() then |
| 3169 | print("checking if `a` is in a list") | 3169 | print("verificando se `a` está na lista") |
| 3170 | end | ||
| 3171 | if not (math.random() > 0.1) then | ||
| 3172 | print("You're lucky!") | ||
| 3173 | end | 3170 | end |
| 3174 | local have_coins = false | 3171 | local have_coins = false |
| 3175 | if have_coins then | 3172 | if have_coins then |
| 3176 | print("Got coins") | 3173 | print("Tem moedas") |
| 3177 | else | 3174 | else |
| 3178 | print("No coins") | 3175 | print("Sem moedas") |
| 3179 | end | 3176 | end |
| 3180 | local have_coins = false | 3177 | local have_coins = false |
| 3181 | if have_coins then | 3178 | if have_coins then |
| 3182 | print("Got coins") | 3179 | print("Tem moedas") |
| 3183 | else | 3180 | else |
| 3184 | print("No coins") | 3181 | print("Sem moedas") |
| 3185 | end | 3182 | end |
| 3186 | local have_coins = false | 3183 | local have_coins = false |
| 3187 | print((function() | 3184 | print((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 |
| 3193 | end)()) | 3190 | end)()) |
| 3194 | local is_tall | 3191 | local is_tall |
| @@ -3201,20 +3198,20 @@ is_tall = function(name) | |||
| 3201 | end | 3198 | end |
| 3202 | local message | 3199 | local message |
| 3203 | if is_tall("Rob") then | 3200 | if is_tall("Rob") then |
| 3204 | message = "I am very tall" | 3201 | message = "Sou muito alto" |
| 3205 | else | 3202 | else |
| 3206 | message = "I am not so tall" | 3203 | message = "Não sou tão alto" |
| 3207 | end | 3204 | end |
| 3208 | print(message) | 3205 | print(message) |
| 3209 | if not (os.date("%A") == "Monday") then | 3206 | if not (os.date("%A") == "Monday") then |
| 3210 | print("it is not Monday!") | 3207 | print("não é segunda-feira!") |
| 3211 | end | 3208 | end |
| 3212 | if not (math.random() > 0.1) then | 3209 | if not (math.random() > 0.1) then |
| 3213 | print("You're lucky!") | 3210 | print("Você tem sorte!") |
| 3214 | end | 3211 | end |
| 3215 | local a = 5 | 3212 | local a = 5 |
| 3216 | if (1 == a or 3 == a or 5 == a or 7 == a) then | 3213 | if (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") |
| 3218 | end | 3215 | end |
| 3219 | if (function() | 3216 | if (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 |
| 3227 | end)() then | 3224 | end)() then |
| 3228 | print("checking if `a` is in a list") | 3225 | print("verificando se `a` está na lista") |
| 3229 | end | ||
| 3230 | if not (math.random() > 0.1) then | ||
| 3231 | print("You're lucky!") | ||
| 3232 | end | 3226 | end |
| 3233 | for i = 10, 20 do | 3227 | for i = 10, 20 do |
| 3234 | print(i) | 3228 | print(i) |
| @@ -3420,11 +3414,11 @@ end | |||
| 3420 | odds = _accum_0 | 3414 | odds = _accum_0 |
| 3421 | local name = "Dan" | 3415 | local name = "Dan" |
| 3422 | if "Robert" == name then | 3416 | if "Robert" == name then |
| 3423 | print("You are Robert") | 3417 | print("Você é Robert") |
| 3424 | elseif "Dan" == name or "Daniel" == name then | 3418 | elseif "Dan" == name or "Daniel" == name then |
| 3425 | print("Your name, it's Dan") | 3419 | print("Seu nome é Dan") |
| 3426 | else | 3420 | else |
| 3427 | print("I don't know about you with name " .. tostring(name)) | 3421 | print("Não sei quem você é com o nome " .. tostring(name)) |
| 3428 | end | 3422 | end |
| 3429 | local b = 1 | 3423 | local b = 1 |
| 3430 | local next_number | 3424 | local next_number |
| @@ -3433,30 +3427,30 @@ if 1 == b then | |||
| 3433 | elseif 2 == b then | 3427 | elseif 2 == b then |
| 3434 | next_number = 3 | 3428 | next_number = 3 |
| 3435 | else | 3429 | else |
| 3436 | next_number = error("can't count that high!") | 3430 | next_number = error("não consigo contar tão alto!") |
| 3437 | end | 3431 | end |
| 3438 | local msg | 3432 | local msg |
| 3439 | local _exp_0 = math.random(1, 5) | 3433 | local _exp_0 = math.random(1, 5) |
| 3440 | if 1 == _exp_0 then | 3434 | if 1 == _exp_0 then |
| 3441 | msg = "you are lucky" | 3435 | msg = "você tem sorte" |
| 3442 | elseif 2 == _exp_0 then | 3436 | elseif 2 == _exp_0 then |
| 3443 | msg = "you are almost lucky" | 3437 | msg = "você quase tem sorte" |
| 3444 | else | 3438 | else |
| 3445 | msg = "not so lucky" | 3439 | msg = "não tão sortudo" |
| 3446 | end | 3440 | end |
| 3447 | do | 3441 | do |
| 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("você tem sorte") |
| 3451 | else | 3445 | else |
| 3452 | print("not so lucky") | 3446 | print("não tão sortudo") |
| 3453 | end | 3447 | end |
| 3454 | end | 3448 | end |
| 3455 | local _exp_0 = math.random(1, 5) | 3449 | local _exp_0 = math.random(1, 5) |
| 3456 | if 1 == _exp_0 then | 3450 | if 1 == _exp_0 then |
| 3457 | print("you are lucky") | 3451 | print("você tem sorte") |
| 3458 | else | 3452 | else |
| 3459 | print("not so lucky") | 3453 | print("não tão sortudo") |
| 3460 | end | 3454 | end |
| 3461 | local items = { | 3455 | local 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 |
| 3568 | end | 3562 | end |
| 3569 | if not _match_0 then | 3563 | if 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 |
| 3580 | end | 3574 | end |
| 3581 | local _exp_0 = tb | 3575 | local _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 |
| 3605 | end | 3599 | end |
| 3606 | if not _match_0 then | 3600 | if 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 |
| 3632 | end | 3626 | end |
| 3633 | local _exp_0 = tb | 3627 | local _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 |
| 3683 | end | 3677 | end |
| 3684 | local segments = { | 3678 | local 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 |
| 3712 | end | 3706 | end |
| 3713 | local name = "Dan" | 3707 | local name = "Dan" |
| 3714 | if "Robert" == name then | 3708 | if "Robert" == name then |
| 3715 | print("You are Robert") | 3709 | print("Você é Robert") |
| 3716 | elseif "Dan" == name or "Daniel" == name then | 3710 | elseif "Dan" == name or "Daniel" == name then |
| 3717 | print("Your name, it's Dan") | 3711 | print("Seu nome é Dan") |
| 3718 | else | 3712 | else |
| 3719 | print("I don't know about you with name " .. tostring(name)) | 3713 | print("Não sei quem você é com o nome " .. tostring(name)) |
| 3720 | end | 3714 | end |
| 3721 | local b = 1 | 3715 | local b = 1 |
| 3722 | local next_number | 3716 | local next_number |
| @@ -3725,30 +3719,30 @@ if 1 == b then | |||
| 3725 | elseif 2 == b then | 3719 | elseif 2 == b then |
| 3726 | next_number = 3 | 3720 | next_number = 3 |
| 3727 | else | 3721 | else |
| 3728 | next_number = error("can't count that high!") | 3722 | next_number = error("não consigo contar tão alto!") |
| 3729 | end | 3723 | end |
| 3730 | local msg | 3724 | local msg |
| 3731 | local _exp_0 = math.random(1, 5) | 3725 | local _exp_0 = math.random(1, 5) |
| 3732 | if 1 == _exp_0 then | 3726 | if 1 == _exp_0 then |
| 3733 | msg = "you are lucky" | 3727 | msg = "você tem sorte" |
| 3734 | elseif 2 == _exp_0 then | 3728 | elseif 2 == _exp_0 then |
| 3735 | msg = "you are almost lucky" | 3729 | msg = "você quase tem sorte" |
| 3736 | else | 3730 | else |
| 3737 | msg = "not so lucky" | 3731 | msg = "não tão sortudo" |
| 3738 | end | 3732 | end |
| 3739 | do | 3733 | do |
| 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("você tem sorte") |
| 3743 | else | 3737 | else |
| 3744 | print("not so lucky") | 3738 | print("não tão sortudo") |
| 3745 | end | 3739 | end |
| 3746 | end | 3740 | end |
| 3747 | local _exp_0 = math.random(1, 5) | 3741 | local _exp_0 = math.random(1, 5) |
| 3748 | if 1 == _exp_0 then | 3742 | if 1 == _exp_0 then |
| 3749 | print("you are lucky") | 3743 | print("você tem sorte") |
| 3750 | else | 3744 | else |
| 3751 | print("not so lucky") | 3745 | print("não tão sortudo") |
| 3752 | end | 3746 | end |
| 3753 | local items = { | 3747 | local 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 |
| 3860 | end | 3854 | end |
| 3861 | if not _match_0 then | 3855 | if 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 |
| 3872 | end | 3866 | end |
| 3873 | local _exp_0 = tb | 3867 | local _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 |
| 3897 | end | 3891 | end |
| 3898 | if not _match_0 then | 3892 | if 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 |
| 3924 | end | 3918 | end |
| 3925 | local _exp_0 = tb | 3919 | local _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 |
| 3975 | end | 3969 | end |
| 3976 | local segments = { | 3970 | local 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 |
| 4004 | end | 3998 | end |
| 4005 | local i = 10 | 3999 | local 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") | |||
| 4519 | local a <const> = 123 | 4513 | local a <const> = 123 |
| 4520 | local _ <close> = setmetatable({ }, { | 4514 | local _ <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 | }) |
| 4525 | local a, b, c, d | 4519 | local a, b, c, d |
| @@ -4529,7 +4523,7 @@ Constant = 123 | |||
| 4529 | local a <const> = 123 | 4523 | local a <const> = 123 |
| 4530 | local _ <close> = setmetatable({ }, { | 4524 | local _ <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 | }) |
| 4535 | local a, b, c, d | 4529 | local a, b, c, d |
| @@ -4688,7 +4682,7 @@ local d = a + b + c | |||
| 4688 | print(d.value) | 4682 | print(d.value) |
| 4689 | local _ <close> = setmetatable({ }, { | 4683 | local _ <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 | }) |
| 4694 | local tb = setmetatable({ }, { | 4688 | local tb = setmetatable({ }, { |
| @@ -4981,7 +4975,7 @@ local d = a + b + c | |||
| 4981 | print(d.value) | 4975 | print(d.value) |
| 4982 | local _ <close> = setmetatable({ }, { | 4976 | local _ <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 | }) |
| 4987 | local tb = setmetatable({ }, { | 4981 | local tb = setmetatable({ }, { |
| @@ -5122,8 +5116,8 @@ local tb = { | |||
| 5122 | } | 5116 | } |
| 5123 | } | 5117 | } |
| 5124 | } | 5118 | } |
| 5125 | local some_string = "Here is a string\n that has a line break in it." | 5119 | local some_string = "Aqui está uma string\n que tem uma quebra de linha." |
| 5126 | print("I am " .. tostring(math.random() * 100) .. "% sure.") | 5120 | print("Tenho " .. tostring(math.random() * 100) .. "% de certeza.") |
| 5127 | local integer = 1000000 | 5121 | local integer = 1000000 |
| 5128 | local hex = 0xEFBBBF | 5122 | local hex = 0xEFBBBF |
| 5129 | local binary = 19 | 5123 | local 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 |
| 5135 | end | 5129 | end |
| 5136 | local str = "path: \"C:\\Program Files\\App\"\nnote: 'He said: \"" .. tostring(Hello) .. "!\"'" | 5130 | local str = "path: \"C:\\Program Files\\App\"\nnote: 'Ele disse: \"" .. tostring(Hello) .. "!\"'" |
| 5137 | local some_string = "Here is a string\n that has a line break in it." | 5131 | local some_string = "Aqui está uma string\n que tem uma quebra de linha." |
| 5138 | print("I am " .. tostring(math.random() * 100) .. "% sure.") | 5132 | print("Tenho " .. tostring(math.random() * 100) .. "% de certeza.") |
| 5139 | local integer = 1000000 | 5133 | local integer = 1000000 |
| 5140 | local hex = 0xEFBBBF | 5134 | local hex = 0xEFBBBF |
| 5141 | local binary = 19 | 5135 | local 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 |
| 5147 | end | 5141 | end |
| 5148 | local str = "path: \"C:\\Program Files\\App\"\nnote: 'He said: \"" .. tostring(Hello) .. "!\"'" | 5142 | local 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() | |||
| 3168 | end)() then | 3168 | end)() then |
| 3169 | print("检查`a`是否在列表中") | 3169 | print("检查`a`是否在列表中") |
| 3170 | end | 3170 | end |
| 3171 | if not (math.random() > 0.1) then | ||
| 3172 | print("你很幸运!") | ||
| 3173 | end | ||
| 3174 | local have_coins = false | 3171 | local have_coins = false |
| 3175 | if have_coins then | 3172 | if have_coins then |
| 3176 | print("有硬币") | 3173 | print("有硬币") |
| @@ -3227,9 +3224,6 @@ if (function() | |||
| 3227 | end)() then | 3224 | end)() then |
| 3228 | print("检查`a`是否在列表中") | 3225 | print("检查`a`是否在列表中") |
| 3229 | end | 3226 | end |
| 3230 | if not (math.random() > 0.1) then | ||
| 3231 | print("你很幸运!") | ||
| 3232 | end | ||
| 3233 | for i = 10, 20 do | 3227 | for i = 10, 20 do |
| 3234 | print(i) | 3228 | print(i) |
| 3235 | end | 3229 | end |
