aboutsummaryrefslogtreecommitdiff
path: root/spec/outputs/codes_from_doc_id-id.lua
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2026-02-06 11:54:32 +0800
committerLi Jin <dragon-fly@qq.com>2026-02-06 11:54:32 +0800
commit1f83d504bc344ffd3c8b4120b3865fd6c11a9e2d (patch)
tree1d5c39eadcbe086d2a592ac76c8f1d288adfbe9d /spec/outputs/codes_from_doc_id-id.lua
parentaa3ecc7badfb39cb9167fb95c9a678257c1d9954 (diff)
downloadyuescript-1f83d504bc344ffd3c8b4120b3865fd6c11a9e2d.tar.gz
yuescript-1f83d504bc344ffd3c8b4120b3865fd6c11a9e2d.tar.bz2
yuescript-1f83d504bc344ffd3c8b4120b3865fd6c11a9e2d.zip
Updated docs.v0.32.9
Diffstat (limited to 'spec/outputs/codes_from_doc_id-id.lua')
-rw-r--r--spec/outputs/codes_from_doc_id-id.lua86
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
83end 83end
84local funcA 84local funcA
85funcA = function() 85funcA = function()
86 return "fail to assign to the Yue macro defined variable" 86 return "gagal meng-assign ke variabel yang didefinisikan oleh macro Yue"
87end 87end
88do 88do
89local function funcB() end 89local function funcB() end
90end 90end
91local funcB 91local funcB
92funcB = function() 92funcB = function()
93 return "fail to assign to the Lua macro defined variable" 93 return "gagal meng-assign ke variabel yang didefinisikan oleh macro Lua"
94end 94end
95do 95do
96-- raw Lua codes insertion 96-- penyisipan kode Lua mentah
97if cond then 97if cond then
98 print("output") 98 print("output")
99end 99end
@@ -122,17 +122,17 @@ do
122end 122end
123local funcA 123local funcA
124funcA = function() 124funcA = function()
125 return "fail to assign to the Yue macro defined variable" 125 return "gagal meng-assign ke variabel yang didefinisikan oleh macro Yue"
126end 126end
127do 127do
128local function funcB() end 128local function funcB() end
129end 129end
130local funcB 130local funcB
131funcB = function() 131funcB = function()
132 return "fail to assign to the Lua macro defined variable" 132 return "gagal meng-assign ke variabel yang didefinisikan oleh macro Lua"
133end 133end
134do 134do
135-- raw Lua codes insertion 135-- penyisipan kode Lua mentah
136if cond then 136if cond then
137 print("output") 137 print("output")
138end 138end
@@ -2488,7 +2488,7 @@ local z = x
2488do 2488do
2489 local a = 1 2489 local a = 1
2490 local x, y, z 2490 local x, y, z
2491 print("forward declare all variables as locals") 2491 print("deklarasikan semua variabel sebagai local di awal")
2492 x = function() 2492 x = function()
2493 return 1 + y + z 2493 return 1 + y + z
2494 end 2494 end
@@ -2498,13 +2498,13 @@ end
2498do 2498do
2499 local X = 1 2499 local X = 1
2500 local B 2500 local B
2501 print("only forward declare upper case variables") 2501 print("hanya deklarasikan variabel huruf besar sebagai local di awal")
2502 local a = 1 2502 local a = 1
2503 B = 2 2503 B = 2
2504end 2504end
2505do 2505do
2506 a = 1 2506 a = 1
2507 print("declare all variables as globals") 2507 print("deklarasikan semua variabel sebagai global")
2508 x = function() 2508 x = function()
2509 return 1 + y + z 2509 return 1 + y + z
2510 end 2510 end
@@ -2512,7 +2512,7 @@ do
2512end 2512end
2513do 2513do
2514 X = 1 2514 X = 1
2515 print("only declare upper case variables as globals") 2515 print("hanya deklarasikan variabel huruf besar sebagai global")
2516 local a = 1 2516 local a = 1
2517 B = 2 2517 B = 2
2518 local Temp = "a local value" 2518 local Temp = "a local value"
@@ -2539,7 +2539,7 @@ local z = x
2539do 2539do
2540 local a = 1 2540 local a = 1
2541 local x, y, z 2541 local x, y, z
2542 print("forward declare all variables as locals") 2542 print("deklarasikan semua variabel sebagai local di awal")
2543 x = function() 2543 x = function()
2544 return 1 + y + z 2544 return 1 + y + z
2545 end 2545 end
@@ -2549,13 +2549,13 @@ end
2549do 2549do
2550 local X = 1 2550 local X = 1
2551 local B 2551 local B
2552 print("only forward declare upper case variables") 2552 print("hanya deklarasikan variabel huruf besar sebagai local di awal")
2553 local a = 1 2553 local a = 1
2554 B = 2 2554 B = 2
2555end 2555end
2556do 2556do
2557 a = 1 2557 a = 1
2558 print("declare all variables as globals") 2558 print("deklarasikan semua variabel sebagai global")
2559 x = function() 2559 x = function()
2560 return 1 + y + z 2560 return 1 + y + z
2561 end 2561 end
@@ -2563,7 +2563,7 @@ do
2563end 2563end
2564do 2564do
2565 X = 1 2565 X = 1
2566 print("only declare upper case variables as globals") 2566 print("hanya deklarasikan variabel huruf besar sebagai global")
2567 local a = 1 2567 local a = 1
2568 B = 2 2568 B = 2
2569 local Temp = "a local value" 2569 local Temp = "a local value"
@@ -3031,7 +3031,7 @@ local apple = setmetatable({
3031if (getmetatable(apple) ~= nil) then 3031if (getmetatable(apple) ~= nil) then
3032 p(apple.size, apple.color, getmetatable(apple).__index) 3032 p(apple.size, apple.color, getmetatable(apple).__index)
3033end 3033end
3034local _u1f31b = "ζœˆδΉ‹θ„šζœ¬" 3034local _u1f31b = "Skrip Bulan"
3035_module_0["πŸŒ›"] = _u1f31b 3035_module_0["πŸŒ›"] = _u1f31b
3036return _module_0 3036return _module_0
3037local _module_0 = { } 3037local _module_0 = { }
@@ -3109,27 +3109,27 @@ local apple = setmetatable({
3109if (getmetatable(apple) ~= nil) then 3109if (getmetatable(apple) ~= nil) then
3110 p(apple.size, apple.color, getmetatable(apple).__index) 3110 p(apple.size, apple.color, getmetatable(apple).__index)
3111end 3111end
3112local _u1f31b = "ζœˆδΉ‹θ„šζœ¬" 3112local _u1f31b = "Skrip Bulan"
3113_module_0["πŸŒ›"] = _u1f31b 3113_module_0["πŸŒ›"] = _u1f31b
3114return _module_0 3114return _module_0
3115local have_coins = false 3115local have_coins = false
3116if have_coins then 3116if have_coins then
3117 print("Got coins") 3117 print("Dapat koin")
3118else 3118else
3119 print("No coins") 3119 print("Tidak ada koin")
3120end 3120end
3121local have_coins = false 3121local have_coins = false
3122if have_coins then 3122if have_coins then
3123 print("Got coins") 3123 print("Dapat koin")
3124else 3124else
3125 print("No coins") 3125 print("Tidak ada koin")
3126end 3126end
3127local have_coins = false 3127local have_coins = false
3128print((function() 3128print((function()
3129 if have_coins then 3129 if have_coins then
3130 return "Got coins" 3130 return "Dapat koin"
3131 else 3131 else
3132 return "No coins" 3132 return "Tidak ada koin"
3133 end 3133 end
3134end)()) 3134end)())
3135local is_tall 3135local is_tall
@@ -3142,20 +3142,20 @@ is_tall = function(name)
3142end 3142end
3143local message 3143local message
3144if is_tall("Rob") then 3144if is_tall("Rob") then
3145 message = "I am very tall" 3145 message = "Saya sangat tinggi"
3146else 3146else
3147 message = "I am not so tall" 3147 message = "Saya tidak terlalu tinggi"
3148end 3148end
3149print(message) 3149print(message)
3150if not (os.date("%A") == "Monday") then 3150if not (os.date("%A") == "Monday") then
3151 print("it is not Monday!") 3151 print("hari ini bukan Senin!")
3152end 3152end
3153if not (math.random() > 0.1) then 3153if not (math.random() > 0.1) then
3154 print("You're lucky!") 3154 print("Kamu beruntung!")
3155end 3155end
3156local a = 5 3156local a = 5
3157if (1 == a or 3 == a or 5 == a or 7 == a) then 3157if (1 == a or 3 == a or 5 == a or 7 == a) then
3158 print("checking equality with discrete values") 3158 print("memeriksa kesamaan dengan nilai-nilai diskrit")
3159end 3159end
3160if (function() 3160if (function()
3161 local _check_0 = list 3161 local _check_0 = list
@@ -3166,29 +3166,26 @@ if (function()
3166 end 3166 end
3167 return false 3167 return false
3168end)() then 3168end)() then
3169 print("checking if `a` is in a list") 3169 print("memeriksa apakah `a` ada di dalam daftar")
3170end
3171if not (math.random() > 0.1) then
3172 print("You're lucky!")
3173end 3170end
3174local have_coins = false 3171local have_coins = false
3175if have_coins then 3172if have_coins then
3176 print("Got coins") 3173 print("Dapat koin")
3177else 3174else
3178 print("No coins") 3175 print("Tidak ada koin")
3179end 3176end
3180local have_coins = false 3177local have_coins = false
3181if have_coins then 3178if have_coins then
3182 print("Got coins") 3179 print("Dapat koin")
3183else 3180else
3184 print("No coins") 3181 print("Tidak ada koin")
3185end 3182end
3186local have_coins = false 3183local have_coins = false
3187print((function() 3184print((function()
3188 if have_coins then 3185 if have_coins then
3189 return "Got coins" 3186 return "Dapat koin"
3190 else 3187 else
3191 return "No coins" 3188 return "Tidak ada koin"
3192 end 3189 end
3193end)()) 3190end)())
3194local is_tall 3191local is_tall
@@ -3201,20 +3198,20 @@ is_tall = function(name)
3201end 3198end
3202local message 3199local message
3203if is_tall("Rob") then 3200if is_tall("Rob") then
3204 message = "I am very tall" 3201 message = "Saya sangat tinggi"
3205else 3202else
3206 message = "I am not so tall" 3203 message = "Saya tidak terlalu tinggi"
3207end 3204end
3208print(message) 3205print(message)
3209if not (os.date("%A") == "Monday") then 3206if not (os.date("%A") == "Monday") then
3210 print("it is not Monday!") 3207 print("hari ini bukan Senin!")
3211end 3208end
3212if not (math.random() > 0.1) then 3209if not (math.random() > 0.1) then
3213 print("You're lucky!") 3210 print("Kamu beruntung!")
3214end 3211end
3215local a = 5 3212local a = 5
3216if (1 == a or 3 == a or 5 == a or 7 == a) then 3213if (1 == a or 3 == a or 5 == a or 7 == a) then
3217 print("checking equality with discrete values") 3214 print("memeriksa kesamaan dengan nilai-nilai diskrit")
3218end 3215end
3219if (function() 3216if (function()
3220 local _check_0 = list 3217 local _check_0 = list
@@ -3225,10 +3222,7 @@ if (function()
3225 end 3222 end
3226 return false 3223 return false
3227end)() then 3224end)() then
3228 print("checking if `a` is in a list") 3225 print("memeriksa apakah `a` ada di dalam daftar")
3229end
3230if not (math.random() > 0.1) then
3231 print("You're lucky!")
3232end 3226end
3233for i = 10, 20 do 3227for i = 10, 20 do
3234 print(i) 3228 print(i)