diff options
Diffstat (limited to 'spec/outputs/codes_from_doc_id-id.lua')
| -rw-r--r-- | spec/outputs/codes_from_doc_id-id.lua | 86 |
1 files changed, 40 insertions, 46 deletions
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) |
