aboutsummaryrefslogtreecommitdiff
path: root/doc/docs/id-id
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 /doc/docs/id-id
parentaa3ecc7badfb39cb9167fb95c9a678257c1d9954 (diff)
downloadyuescript-1f83d504bc344ffd3c8b4120b3865fd6c11a9e2d.tar.gz
yuescript-1f83d504bc344ffd3c8b4120b3865fd6c11a9e2d.tar.bz2
yuescript-1f83d504bc344ffd3c8b4120b3865fd6c11a9e2d.zip
Updated docs.v0.32.9
Diffstat (limited to 'doc/docs/id-id')
-rw-r--r--doc/docs/id-id/doc/advanced/do.md8
-rw-r--r--doc/docs/id-id/doc/advanced/line-decorators.md8
-rw-r--r--doc/docs/id-id/doc/advanced/macro.md66
-rw-r--r--doc/docs/id-id/doc/advanced/module.md58
-rw-r--r--doc/docs/id-id/doc/advanced/try.md20
-rw-r--r--doc/docs/id-id/doc/assignment/assignment.md40
-rw-r--r--doc/docs/id-id/doc/assignment/destructuring-assignment.md50
-rw-r--r--doc/docs/id-id/doc/assignment/if-assignment.md18
-rw-r--r--doc/docs/id-id/doc/assignment/the-using-clause-controlling-destructive-assignment.md36
-rw-r--r--doc/docs/id-id/doc/assignment/varargs-assignment.md4
-rw-r--r--doc/docs/id-id/doc/control-flow/conditionals.md69
-rw-r--r--doc/docs/id-id/doc/control-flow/continue.md6
-rw-r--r--doc/docs/id-id/doc/control-flow/for-loop.md24
-rw-r--r--doc/docs/id-id/doc/control-flow/switch.md32
-rw-r--r--doc/docs/id-id/doc/control-flow/while-loop.md8
-rw-r--r--doc/docs/id-id/doc/data-structures/comprehensions.md64
-rw-r--r--doc/docs/id-id/doc/data-structures/table-literals.md20
-rw-r--r--doc/docs/id-id/doc/functions/backcalls.md10
-rw-r--r--doc/docs/id-id/doc/functions/function-literals.md86
-rw-r--r--doc/docs/id-id/doc/functions/function-stubs.md24
-rw-r--r--doc/docs/id-id/doc/getting-started/installation.md24
-rw-r--r--doc/docs/id-id/doc/getting-started/introduction.md16
-rw-r--r--doc/docs/id-id/doc/getting-started/usage.md117
-rwxr-xr-xdoc/docs/id-id/doc/index.md10
-rw-r--r--doc/docs/id-id/doc/language-basics/attributes.md8
-rw-r--r--doc/docs/id-id/doc/language-basics/comment.md22
-rw-r--r--doc/docs/id-id/doc/language-basics/literals.md30
-rw-r--r--doc/docs/id-id/doc/language-basics/operator.md90
-rw-r--r--doc/docs/id-id/doc/language-basics/whitespace.md12
-rw-r--r--doc/docs/id-id/doc/objects/object-oriented-programming.md158
-rw-r--r--doc/docs/id-id/doc/objects/with-statement.md27
-rw-r--r--doc/docs/id-id/doc/reference/license-mit.md37
-rw-r--r--doc/docs/id-id/doc/reference/the-yuescript-library.md554
-rw-r--r--doc/docs/id-id/index.md20
-rwxr-xr-xdoc/docs/id-id/try/index.md4
35 files changed, 883 insertions, 897 deletions
diff --git a/doc/docs/id-id/doc/advanced/do.md b/doc/docs/id-id/doc/advanced/do.md
index 4990d6f..ebbd2e2 100644
--- a/doc/docs/id-id/doc/advanced/do.md
+++ b/doc/docs/id-id/doc/advanced/do.md
@@ -1,12 +1,12 @@
1# Do 1# Do
2 2
3When used as a statement, do works just like it does in Lua. 3Saat digunakan sebagai pernyataan, `do` bekerja seperti di Lua.
4 4
5```yuescript 5```yuescript
6do 6do
7 var = "hello" 7 var = "hello"
8 print var 8 print var
9print var -- nil here 9print var -- nil di sini
10``` 10```
11<YueDisplay> 11<YueDisplay>
12 12
@@ -14,12 +14,12 @@ print var -- nil here
14do 14do
15 var = "hello" 15 var = "hello"
16 print var 16 print var
17print var -- nil here 17print var -- nil di sini
18``` 18```
19 19
20</YueDisplay> 20</YueDisplay>
21 21
22YueScript's **do** can also be used an expression . Allowing you to combine multiple lines into one. The result of the do expression is the last statement in its body. 22`do` di YueScript juga bisa digunakan sebagai ekspresi, memungkinkan Anda menggabungkan beberapa baris menjadi satu. Hasil ekspresi `do` adalah pernyataan terakhir di badannya.
23 23
24```yuescript 24```yuescript
25counter = do 25counter = do
diff --git a/doc/docs/id-id/doc/advanced/line-decorators.md b/doc/docs/id-id/doc/advanced/line-decorators.md
index 292bc77..e90e205 100644
--- a/doc/docs/id-id/doc/advanced/line-decorators.md
+++ b/doc/docs/id-id/doc/advanced/line-decorators.md
@@ -1,6 +1,6 @@
1# Line Decorators 1# Dekorator Baris
2 2
3For convenience, the for loop and if statement can be applied to single statements at the end of the line: 3Untuk kemudahan, loop for dan pernyataan if dapat diterapkan pada pernyataan tunggal di akhir baris:
4 4
5```yuescript 5```yuescript
6print "hello world" if name == "Rob" 6print "hello world" if name == "Rob"
@@ -13,7 +13,7 @@ print "hello world" if name == "Rob"
13 13
14</YueDisplay> 14</YueDisplay>
15 15
16And with basic loops: 16Dan dengan loop dasar:
17 17
18```yuescript 18```yuescript
19print "item: ", item for item in *items 19print "item: ", item for item in *items
@@ -26,7 +26,7 @@ print "item: ", item for item in *items
26 26
27</YueDisplay> 27</YueDisplay>
28 28
29And with while loops: 29Dan dengan loop while:
30 30
31```yuescript 31```yuescript
32game\update! while game\isRunning! 32game\update! while game\isRunning!
diff --git a/doc/docs/id-id/doc/advanced/macro.md b/doc/docs/id-id/doc/advanced/macro.md
index 6d194c3..ce0bafa 100644
--- a/doc/docs/id-id/doc/advanced/macro.md
+++ b/doc/docs/id-id/doc/advanced/macro.md
@@ -1,8 +1,8 @@
1# Macro 1# Makro
2 2
3## Common Usage 3## Penggunaan Umum
4 4
5Macro function is used for evaluating a string in the compile time and insert the generated codes into final compilation. 5Fungsi macro digunakan untuk mengevaluasi string pada waktu kompilasi dan menyisipkan kode yang dihasilkan ke kompilasi akhir.
6 6
7```yuescript 7```yuescript
8macro PI2 = -> math.pi * 2 8macro PI2 = -> math.pi * 2
@@ -27,7 +27,7 @@ $asserts item ~= nil
27$config false 27$config false
28value = $assert item 28value = $assert item
29 29
30-- the passed expressions are treated as strings 30-- ekspresi yang dikirim diperlakukan sebagai string
31macro and = (...) -> "#{ table.concat {...}, ' and ' }" 31macro and = (...) -> "#{ table.concat {...}, ' and ' }"
32if $and f1!, f2!, f3! 32if $and f1!, f2!, f3!
33 print "OK" 33 print "OK"
@@ -57,7 +57,7 @@ $asserts item ~= nil
57$config false 57$config false
58value = $assert item 58value = $assert item
59 59
60-- the passed expressions are treated as strings 60-- ekspresi yang dikirim diperlakukan sebagai string
61macro and = (...) -> "#{ table.concat {...}, ' and ' }" 61macro and = (...) -> "#{ table.concat {...}, ' and ' }"
62if $and f1!, f2!, f3! 62if $and f1!, f2!, f3!
63 print "OK" 63 print "OK"
@@ -65,29 +65,29 @@ if $and f1!, f2!, f3!
65 65
66</YueDisplay> 66</YueDisplay>
67 67
68## Insert Raw Codes 68## Menyisipkan Kode Mentah
69 69
70A macro function can either return a YueScript string or a config table containing Lua codes. 70Fungsi macro bisa mengembalikan string YueScript atau tabel konfigurasi yang berisi kode Lua.
71```yuescript 71```yuescript
72macro yueFunc = (var) -> "local #{var} = ->" 72macro yueFunc = (var) -> "local #{var} = ->"
73$yueFunc funcA 73$yueFunc funcA
74funcA = -> "fail to assign to the Yue macro defined variable" 74funcA = -> "gagal meng-assign ke variabel yang didefinisikan oleh macro Yue"
75 75
76macro luaFunc = (var) -> { 76macro luaFunc = (var) -> {
77 code: "local function #{var}() end" 77 code: "local function #{var}() end"
78 type: "lua" 78 type: "lua"
79} 79}
80$luaFunc funcB 80$luaFunc funcB
81funcB = -> "fail to assign to the Lua macro defined variable" 81funcB = -> "gagal meng-assign ke variabel yang didefinisikan oleh macro Lua"
82 82
83macro lua = (code) -> { 83macro lua = (code) -> {
84 :code 84 :code
85 type: "lua" 85 type: "lua"
86} 86}
87 87
88-- the raw string leading and ending symbols are auto trimed 88-- simbol awal dan akhir string mentah otomatis di-trim
89$lua[==[ 89$lua[==[
90-- raw Lua codes insertion 90-- penyisipan kode Lua mentah
91if cond then 91if cond then
92 print("output") 92 print("output")
93end 93end
@@ -98,23 +98,23 @@ end
98```yue 98```yue
99macro yueFunc = (var) -> "local #{var} = ->" 99macro yueFunc = (var) -> "local #{var} = ->"
100$yueFunc funcA 100$yueFunc funcA
101funcA = -> "fail to assign to the Yue macro defined variable" 101funcA = -> "gagal meng-assign ke variabel yang didefinisikan oleh macro Yue"
102 102
103macro luaFunc = (var) -> { 103macro luaFunc = (var) -> {
104 code: "local function #{var}() end" 104 code: "local function #{var}() end"
105 type: "lua" 105 type: "lua"
106} 106}
107$luaFunc funcB 107$luaFunc funcB
108funcB = -> "fail to assign to the Lua macro defined variable" 108funcB = -> "gagal meng-assign ke variabel yang didefinisikan oleh macro Lua"
109 109
110macro lua = (code) -> { 110macro lua = (code) -> {
111 :code 111 :code
112 type: "lua" 112 type: "lua"
113} 113}
114 114
115-- the raw string leading and ending symbols are auto trimed 115-- simbol awal dan akhir string mentah otomatis di-trim
116$lua[==[ 116$lua[==[
117-- raw Lua codes insertion 117-- penyisipan kode Lua mentah
118if cond then 118if cond then
119 print("output") 119 print("output")
120end 120end
@@ -125,7 +125,7 @@ end
125 125
126## Export Macro 126## Export Macro
127 127
128Macro functions can be exported from a module and get imported in another module. You have to put export macro functions in a single file to be used, and only macro definition, macro importing and macro expansion in place can be put into the macro exporting module. 128Fungsi macro dapat diekspor dari modul dan diimpor di modul lain. Anda harus menaruh fungsi macro export dalam satu file agar dapat digunakan, dan hanya definisi macro, impor macro, dan ekspansi macro yang boleh ada di modul export macro.
129```yuescript 129```yuescript
130-- file: utils.yue 130-- file: utils.yue
131export macro map = (items, action) -> "[#{action} for _ in *#{items}]" 131export macro map = (items, action) -> "[#{action} for _ in *#{items}]"
@@ -135,8 +135,8 @@ export macro foreach = (items, action) -> "for _ in *#{items}
135 135
136-- file main.yue 136-- file main.yue
137import "utils" as { 137import "utils" as {
138 $, -- symbol to import all macros 138 $, -- simbol untuk mengimpor semua macro
139 $foreach: $each -- rename macro $foreach to $each 139 $foreach: $each -- ganti nama macro $foreach menjadi $each
140} 140}
141[1, 2, 3] |> $map(_ * 2) |> $filter(_ > 4) |> $each print _ 141[1, 2, 3] |> $map(_ * 2) |> $filter(_ > 4) |> $each print _
142``` 142```
@@ -150,11 +150,11 @@ export macro foreach = (items, action) -> "for _ in *#{items}
150 #{action}" 150 #{action}"
151 151
152-- file main.yue 152-- file main.yue
153-- import function is not available in browser, try it in a real environment 153-- fungsi import tidak tersedia di browser, coba di lingkungan nyata
154--[[ 154--[[
155import "utils" as { 155import "utils" as {
156 $, -- symbol to import all macros 156 $, -- simbol untuk mengimpor semua macro
157 $foreach: $each -- rename macro $foreach to $each 157 $foreach: $each -- ganti nama macro $foreach menjadi $each
158} 158}
159[1, 2, 3] |> $map(_ * 2) |> $filter(_ > 4) |> $each print _ 159[1, 2, 3] |> $map(_ * 2) |> $filter(_ > 4) |> $each print _
160]] 160]]
@@ -162,25 +162,25 @@ import "utils" as {
162 162
163</YueDisplay> 163</YueDisplay>
164 164
165## Builtin Macro 165## Macro Bawaan
166 166
167There are some builtin macros but you can override them by declaring macros with the same names. 167Ada beberapa macro bawaan tetapi Anda bisa menimpanya dengan mendeklarasikan macro dengan nama yang sama.
168```yuescript 168```yuescript
169print $FILE -- get string of current module name 169print $FILE -- mendapatkan string nama modul saat ini
170print $LINE -- get number 2 170print $LINE -- mendapatkan angka 2
171``` 171```
172<YueDisplay> 172<YueDisplay>
173 173
174```yue 174```yue
175print $FILE -- get string of current module name 175print $FILE -- mendapatkan string nama modul saat ini
176print $LINE -- get number 2 176print $LINE -- mendapatkan angka 2
177``` 177```
178 178
179</YueDisplay> 179</YueDisplay>
180 180
181## Generating Macros with Macros 181## Menghasilkan Macro dengan Macro
182 182
183In YueScript, macro functions allow you to generate code at compile time. By nesting macro functions, you can create more complex generation patterns. This feature enables you to define a macro function that generates another macro function, allowing for more dynamic code generation. 183Di YueScript, fungsi macro memungkinkan Anda menghasilkan kode pada waktu kompilasi. Dengan menumpuk fungsi macro, Anda dapat membuat pola generasi yang lebih kompleks. Fitur ini memungkinkan Anda mendefinisikan fungsi macro yang menghasilkan fungsi macro lain, sehingga menghasilkan kode yang lebih dinamis.
184 184
185```yuescript 185```yuescript
186macro Enum = (...) -> 186macro Enum = (...) ->
@@ -222,9 +222,9 @@ print "Valid enum type:", $BodyType Static
222 222
223</YueDisplay> 223</YueDisplay>
224 224
225## Argument Validation 225## Validasi Argumen
226 226
227You can declare the expected AST node types in the argument list, and check whether the incoming macro arguments meet the expectations at compile time. 227Anda dapat mendeklarasikan tipe node AST yang diharapkan dalam daftar argumen, dan memeriksa apakah argumen macro yang masuk memenuhi harapan pada waktu kompilasi.
228 228
229```yuescript 229```yuescript
230macro printNumAndStr = (num `Num, str `String) -> | 230macro printNumAndStr = (num `Num, str `String) -> |
@@ -249,7 +249,7 @@ $printNumAndStr 123, "hello"
249 249
250</YueDisplay> 250</YueDisplay>
251 251
252If you need more flexible argument checking, you can use the built-in `$is_ast` macro function to manually check at the appropriate place. 252Jika Anda membutuhkan pengecekan argumen yang lebih fleksibel, Anda dapat menggunakan fungsi macro bawaan `$is_ast` untuk memeriksa secara manual pada tempat yang tepat.
253 253
254```yuescript 254```yuescript
255macro printNumAndStr = (num, str) -> 255macro printNumAndStr = (num, str) ->
@@ -272,4 +272,4 @@ $printNumAndStr 123, "hello"
272 272
273</YueDisplay> 273</YueDisplay>
274 274
275For more details about available AST nodes, please refer to the uppercased definitions in [yue_parser.cpp](https://github.com/IppClub/YueScript/blob/main/src/yuescript/yue_parser.cpp). 275Untuk detail lebih lanjut tentang node AST yang tersedia, silakan lihat definisi huruf besar di [yue_parser.cpp](https://github.com/IppClub/YueScript/blob/main/src/yuescript/yue_parser.cpp).
diff --git a/doc/docs/id-id/doc/advanced/module.md b/doc/docs/id-id/doc/advanced/module.md
index c955092..dd97a32 100644
--- a/doc/docs/id-id/doc/advanced/module.md
+++ b/doc/docs/id-id/doc/advanced/module.md
@@ -1,28 +1,28 @@
1# Module 1# Modul
2 2
3## Import 3## Import
4 4
5The import statement is a syntax sugar for requiring a module or help extracting items from an imported module. The imported items are const by default. 5Pernyataan `import` adalah sintaks sugar untuk me-require modul atau membantu mengekstrak item dari modul yang diimpor. Item yang diimpor bersifat `const` secara default.
6 6
7```yuescript 7```yuescript
8-- used as table destructuring 8-- digunakan sebagai destrukturisasi tabel
9do 9do
10 import insert, concat from table 10 import insert, concat from table
11 -- report error when assigning to insert, concat 11 -- akan error saat meng-assign ke insert, concat
12 import C, Ct, Cmt from require "lpeg" 12 import C, Ct, Cmt from require "lpeg"
13 -- shortcut for implicit requiring 13 -- shortcut untuk require implisit
14 import x, y, z from 'mymodule' 14 import x, y, z from 'mymodule'
15 -- import with Python style 15 -- import gaya Python
16 from 'module' import a, b, c 16 from 'module' import a, b, c
17 17
18-- shortcut for requring a module 18-- shortcut untuk require modul
19do 19do
20 import 'module' 20 import 'module'
21 import 'module_x' 21 import 'module_x'
22 import "d-a-s-h-e-s" 22 import "d-a-s-h-e-s"
23 import "module.part" 23 import "module.part"
24 24
25-- requring module with aliasing or table destructuring 25-- require modul dengan aliasing atau destrukturisasi tabel
26do 26do
27 import "player" as PlayerModule 27 import "player" as PlayerModule
28 import "lpeg" as :C, :Ct, :Cmt 28 import "lpeg" as :C, :Ct, :Cmt
@@ -31,24 +31,24 @@ do
31<YueDisplay> 31<YueDisplay>
32 32
33```yue 33```yue
34-- used as table destructuring 34-- digunakan sebagai destrukturisasi tabel
35do 35do
36 import insert, concat from table 36 import insert, concat from table
37 -- report error when assigning to insert, concat 37 -- akan error saat meng-assign ke insert, concat
38 import C, Ct, Cmt from require "lpeg" 38 import C, Ct, Cmt from require "lpeg"
39 -- shortcut for implicit requiring 39 -- shortcut untuk require implisit
40 import x, y, z from 'mymodule' 40 import x, y, z from 'mymodule'
41 -- import with Python style 41 -- import gaya Python
42 from 'module' import a, b, c 42 from 'module' import a, b, c
43 43
44-- shortcut for requring a module 44-- shortcut untuk require modul
45do 45do
46 import 'module' 46 import 'module'
47 import 'module_x' 47 import 'module_x'
48 import "d-a-s-h-e-s" 48 import "d-a-s-h-e-s"
49 import "module.part" 49 import "module.part"
50 50
51-- requring module with aliasing or table destructuring 51-- require modul dengan aliasing atau destrukturisasi tabel
52do 52do
53 import "player" as PlayerModule 53 import "player" as PlayerModule
54 import "lpeg" as :C, :Ct, :Cmt 54 import "lpeg" as :C, :Ct, :Cmt
@@ -59,7 +59,7 @@ do
59 59
60## Import Global 60## Import Global
61 61
62You can import specific globals into local variables with `import`. When importing a chain of global variable accessings, the last field will be assigned to the local variable. 62Anda dapat mengimpor global tertentu ke variabel local dengan `import`. Saat mengimpor rangkaian akses variabel global, field terakhir akan di-assign ke variabel local.
63 63
64```yuescript 64```yuescript
65do 65do
@@ -78,11 +78,11 @@ do
78 78
79</YueDisplay> 79</YueDisplay>
80 80
81### Automatic Global Variable Import 81### Import Variabel Global Otomatis
82 82
83You can place `import global` at the top of a block to automatically import all names that have not been explicitly declared or assigned in the current scope as globals. These implicit imports are treated as local consts that reference the corresponding globals at the position of the statement. 83Anda dapat menempatkan `import global` di awal blok untuk mengimpor secara otomatis semua nama yang belum dideklarasikan atau di-assign secara eksplisit di scope saat ini sebagai global. Import implisit ini diperlakukan sebagai local const yang mereferensikan global terkait pada posisi pernyataan tersebut.
84 84
85Names that are explicitly declared as globals in the same scope will not be imported, so you can still assign to them. 85Nama yang secara eksplisit dideklarasikan sebagai global di scope yang sama tidak akan diimpor, sehingga Anda masih bisa meng-assign ke mereka.
86 86
87```yuescript 87```yuescript
88do 88do
@@ -92,7 +92,7 @@ do
92 -- print = nil -- error: imported globals are const 92 -- print = nil -- error: imported globals are const
93 93
94do 94do
95 -- explicit global variable will not be imported 95 -- variabel global eksplisit tidak akan diimpor
96 import global 96 import global
97 global FLAG 97 global FLAG
98 print FLAG 98 print FLAG
@@ -108,7 +108,7 @@ do
108 -- print = nil -- error: imported globals are const 108 -- print = nil -- error: imported globals are const
109 109
110do 110do
111 -- explicit global variable will not be imported 111 -- variabel global eksplisit tidak akan diimpor
112 import global 112 import global
113 global FLAG 113 global FLAG
114 print FLAG 114 print FLAG
@@ -119,11 +119,11 @@ do
119 119
120## Export 120## Export
121 121
122The export statement offers a concise way to define modules. 122Pernyataan `export` menawarkan cara ringkas untuk mendefinisikan modul.
123 123
124### Named Export 124### Export Bernama
125 125
126Named export will define a local variable as well as adding a field in the exported table. 126Export bernama akan mendefinisikan variabel local sekaligus menambahkan field di tabel export.
127 127
128```yuescript 128```yuescript
129export a, b, c = 1, 2, 3 129export a, b, c = 1, 2, 3
@@ -160,7 +160,7 @@ export class Something
160 160
161</YueDisplay> 161</YueDisplay>
162 162
163Doing named export with destructuring. 163Melakukan export bernama dengan destrukturisasi.
164 164
165```yuescript 165```yuescript
166export :loadstring, to_lua: tolua = yue 166export :loadstring, to_lua: tolua = yue
@@ -175,7 +175,7 @@ export {itemA: {:fieldA = 'default'}} = tb
175 175
176</YueDisplay> 176</YueDisplay>
177 177
178Export named items from module without creating local variables. 178Export item bernama dari modul tanpa membuat variabel local.
179 179
180```yuescript 180```yuescript
181export.itemA = tb 181export.itemA = tb
@@ -192,9 +192,9 @@ export["a-b-c"] = 123
192 192
193</YueDisplay> 193</YueDisplay>
194 194
195### Unnamed Export 195### Export Tanpa Nama
196 196
197Unnamed export will add the target item into the array part of the exported table. 197Export tanpa nama akan menambahkan item target ke bagian array dari tabel export.
198 198
199```yuescript 199```yuescript
200d, e, f = 3, 2, 1 200d, e, f = 3, 2, 1
@@ -225,9 +225,9 @@ export with tmp
225 225
226</YueDisplay> 226</YueDisplay>
227 227
228### Default Export 228### Export Default
229 229
230Using the **default** keyword in export statement to replace the exported table with any thing. 230Gunakan kata kunci **default** dalam pernyataan export untuk mengganti tabel export dengan apa pun.
231 231
232```yuescript 232```yuescript
233export default -> 233export default ->
diff --git a/doc/docs/id-id/doc/advanced/try.md b/doc/docs/id-id/doc/advanced/try.md
index 23c7877..6607451 100644
--- a/doc/docs/id-id/doc/advanced/try.md
+++ b/doc/docs/id-id/doc/advanced/try.md
@@ -1,6 +1,6 @@
1# Try 1# Try
2 2
3The syntax for Lua error handling in a common form. 3Sintaks untuk penanganan error Lua dalam bentuk umum.
4 4
5```yuescript 5```yuescript
6try 6try
@@ -23,7 +23,7 @@ try
23 print "trying" 23 print "trying"
24 func 1, 2, 3 24 func 1, 2, 3
25 25
26-- working with if assignment pattern 26-- bekerja dengan pola if assignment
27if success, result := try func 1, 2, 3 27if success, result := try func 1, 2, 3
28catch err 28catch err
29 print yue.traceback err 29 print yue.traceback err
@@ -52,7 +52,7 @@ try
52 print "trying" 52 print "trying"
53 func 1, 2, 3 53 func 1, 2, 3
54 54
55-- working with if assignment pattern 55-- bekerja dengan pola if assignment
56if success, result := try func 1, 2, 3 56if success, result := try func 1, 2, 3
57catch err 57catch err
58 print yue.traceback err 58 print yue.traceback err
@@ -63,18 +63,18 @@ catch err
63 63
64## Try? 64## Try?
65 65
66`try?` is a simplified use for error handling syntax that omit the boolean status from the `try` statement, and it will return the result from the try block when success, return nil instead of error object otherwise. 66`try?` adalah bentuk sederhana untuk penanganan error yang menghilangkan status boolean dari pernyataan `try`, dan akan mengembalikan hasil dari blok try ketika berhasil, atau mengembalikan nil alih-alih objek error bila gagal.
67 67
68```yuescript 68```yuescript
69a, b, c = try? func! 69a, b, c = try? func!
70 70
71-- with nil coalescing operator 71-- dengan operator nil coalescing
72a = (try? func!) ?? "default" 72a = (try? func!) ?? "default"
73 73
74-- as function argument 74-- sebagai argumen fungsi
75f try? func! 75f try? func!
76 76
77-- with catch block 77-- dengan blok catch
78f try? 78f try?
79 print 123 79 print 123
80 func! 80 func!
@@ -87,13 +87,13 @@ catch e
87```yue 87```yue
88a, b, c = try? func! 88a, b, c = try? func!
89 89
90-- with nil coalescing operator 90-- dengan operator nil coalescing
91a = (try? func!) ?? "default" 91a = (try? func!) ?? "default"
92 92
93-- as function argument 93-- sebagai argumen fungsi
94f try? func! 94f try? func!
95 95
96-- with catch block 96-- dengan blok catch
97f try? 97f try?
98 print 123 98 print 123
99 func! 99 func!
diff --git a/doc/docs/id-id/doc/assignment/assignment.md b/doc/docs/id-id/doc/assignment/assignment.md
index 4dac6f4..d9fd45d 100644
--- a/doc/docs/id-id/doc/assignment/assignment.md
+++ b/doc/docs/id-id/doc/assignment/assignment.md
@@ -1,25 +1,25 @@
1# Assignment 1# Penugasan
2 2
3The variable is dynamic typed and is defined as local by default. But you can change the scope of declaration by **local** and **global** statement. 3Variabel bersifat bertipe dinamis dan secara default dideklarasikan sebagai local. Namun Anda dapat mengubah cakupan deklarasi dengan pernyataan **local** dan **global**.
4 4
5```yuescript 5```yuescript
6hello = "world" 6hello = "world"
7a, b, c = 1, 2, 3 7a, b, c = 1, 2, 3
8hello = 123 -- uses the existing variable 8hello = 123 -- menggunakan variabel yang sudah ada
9``` 9```
10<YueDisplay> 10<YueDisplay>
11 11
12```yue 12```yue
13hello = "world" 13hello = "world"
14a, b, c = 1, 2, 3 14a, b, c = 1, 2, 3
15hello = 123 -- uses the existing variable 15hello = 123 -- menggunakan variabel yang sudah ada
16``` 16```
17 17
18</YueDisplay> 18</YueDisplay>
19 19
20## Perform Update 20## Pembaruan Nilai
21 21
22You can perform update assignment with many binary operators. 22Anda dapat melakukan assignment pembaruan dengan banyak operator biner.
23```yuescript 23```yuescript
24x = 1 24x = 1
25x += 1 25x += 1
@@ -27,7 +27,7 @@ x -= 1
27x *= 10 27x *= 10
28x /= 10 28x /= 10
29x %= 10 29x %= 10
30s ..= "world" -- will add a new local if local variable is not exist 30s ..= "world" -- akan menambah local baru jika variabel local belum ada
31arg or= "default value" 31arg or= "default value"
32``` 32```
33<YueDisplay> 33<YueDisplay>
@@ -39,15 +39,15 @@ x -= 1
39x *= 10 39x *= 10
40x /= 10 40x /= 10
41x %= 10 41x %= 10
42s ..= "world" -- will add a new local if local variable is not exist 42s ..= "world" -- akan menambah local baru jika variabel local belum ada
43arg or= "default value" 43arg or= "default value"
44``` 44```
45 45
46</YueDisplay> 46</YueDisplay>
47 47
48## Chaining Assignment 48## Assignment Berantai
49 49
50You can do chaining assignment to assign multiple items to hold the same value. 50Anda bisa melakukan assignment berantai untuk menetapkan beberapa item ke nilai yang sama.
51```yuescript 51```yuescript
52a = b = c = d = e = 0 52a = b = c = d = e = 0
53x = y = z = f! 53x = y = z = f!
@@ -61,12 +61,12 @@ x = y = z = f!
61 61
62</YueDisplay> 62</YueDisplay>
63 63
64## Explicit Locals 64## Local Eksplisit
65```yuescript 65```yuescript
66do 66do
67 local a = 1 67 local a = 1
68 local * 68 local *
69 print "forward declare all variables as locals" 69 print "deklarasikan semua variabel sebagai local di awal"
70 x = -> 1 + y + z 70 x = -> 1 + y + z
71 y, z = 2, 3 71 y, z = 2, 3
72 global instance = Item\new! 72 global instance = Item\new!
@@ -74,7 +74,7 @@ do
74do 74do
75 local X = 1 75 local X = 1
76 local ^ 76 local ^
77 print "only forward declare upper case variables" 77 print "hanya deklarasikan variabel huruf besar sebagai local di awal"
78 a = 1 78 a = 1
79 B = 2 79 B = 2
80``` 80```
@@ -84,7 +84,7 @@ do
84do 84do
85 local a = 1 85 local a = 1
86 local * 86 local *
87 print "forward declare all variables as locals" 87 print "deklarasikan semua variabel sebagai local di awal"
88 x = -> 1 + y + z 88 x = -> 1 + y + z
89 y, z = 2, 3 89 y, z = 2, 3
90 global instance = Item\new! 90 global instance = Item\new!
@@ -92,26 +92,26 @@ do
92do 92do
93 local X = 1 93 local X = 1
94 local ^ 94 local ^
95 print "only forward declare upper case variables" 95 print "hanya deklarasikan variabel huruf besar sebagai local di awal"
96 a = 1 96 a = 1
97 B = 2 97 B = 2
98``` 98```
99 99
100</YueDisplay> 100</YueDisplay>
101 101
102## Explicit Globals 102## Global Eksplisit
103```yuescript 103```yuescript
104do 104do
105 global a = 1 105 global a = 1
106 global * 106 global *
107 print "declare all variables as globals" 107 print "deklarasikan semua variabel sebagai global"
108 x = -> 1 + y + z 108 x = -> 1 + y + z
109 y, z = 2, 3 109 y, z = 2, 3
110 110
111do 111do
112 global X = 1 112 global X = 1
113 global ^ 113 global ^
114 print "only declare upper case variables as globals" 114 print "hanya deklarasikan variabel huruf besar sebagai global"
115 a = 1 115 a = 1
116 B = 2 116 B = 2
117 local Temp = "a local value" 117 local Temp = "a local value"
@@ -122,14 +122,14 @@ do
122do 122do
123 global a = 1 123 global a = 1
124 global * 124 global *
125 print "declare all variables as globals" 125 print "deklarasikan semua variabel sebagai global"
126 x = -> 1 + y + z 126 x = -> 1 + y + z
127 y, z = 2, 3 127 y, z = 2, 3
128 128
129do 129do
130 global X = 1 130 global X = 1
131 global ^ 131 global ^
132 print "only declare upper case variables as globals" 132 print "hanya deklarasikan variabel huruf besar sebagai global"
133 a = 1 133 a = 1
134 B = 2 134 B = 2
135 local Temp = "a local value" 135 local Temp = "a local value"
diff --git a/doc/docs/id-id/doc/assignment/destructuring-assignment.md b/doc/docs/id-id/doc/assignment/destructuring-assignment.md
index e7b8046..ba591fd 100644
--- a/doc/docs/id-id/doc/assignment/destructuring-assignment.md
+++ b/doc/docs/id-id/doc/assignment/destructuring-assignment.md
@@ -1,10 +1,10 @@
1# Destructuring Assignment 1# Penugasan Destrukturisasi
2 2
3Destructuring assignment is a way to quickly extract values from a table by their name or position in array based tables. 3Assignment destrukturisasi adalah cara cepat untuk mengekstrak nilai dari sebuah tabel berdasarkan nama kunci atau posisinya pada tabel berbasis array.
4 4
5Typically when you see a table literal, {1,2,3}, it is on the right hand side of an assignment because it is a value. Destructuring assignment swaps the role of the table literal, and puts it on the left hand side of an assign statement. 5Biasanya ketika Anda melihat literal tabel, `{1,2,3}`, ia berada di sisi kanan assignment karena merupakan nilai. Assignment destrukturisasi menukar peran literal tabel dan menaruhnya di sisi kiri pernyataan assignment.
6 6
7This is best explained with examples. Here is how you would unpack the first two values from a table: 7Ini paling mudah dijelaskan dengan contoh. Berikut cara membongkar dua nilai pertama dari sebuah tabel:
8 8
9```yuescript 9```yuescript
10thing = [1, 2] 10thing = [1, 2]
@@ -23,7 +23,7 @@ print a, b
23 23
24</YueDisplay> 24</YueDisplay>
25 25
26In the destructuring table literal, the key represents the key to read from the right hand side, and the value represents the name the read value will be assigned to. 26Di literal tabel destrukturisasi, kunci mewakili kunci yang dibaca dari sisi kanan, dan nilai mewakili nama yang akan menerima nilai tersebut.
27 27
28```yuescript 28```yuescript
29obj = { 29obj = {
@@ -35,7 +35,7 @@ obj = {
35{hello: hello, day: the_day} = obj 35{hello: hello, day: the_day} = obj
36print hello, the_day 36print hello, the_day
37 37
38:day = obj -- OK to do simple destructuring without braces 38:day = obj -- OK untuk destrukturisasi sederhana tanpa kurung
39``` 39```
40<YueDisplay> 40<YueDisplay>
41 41
@@ -49,12 +49,12 @@ obj = {
49{hello: hello, day: the_day} = obj 49{hello: hello, day: the_day} = obj
50print hello, the_day 50print hello, the_day
51 51
52:day = obj -- OK to do simple destructuring without braces 52:day = obj -- OK untuk destrukturisasi sederhana tanpa kurung
53``` 53```
54 54
55</YueDisplay> 55</YueDisplay>
56 56
57This also works with nested data structures as well: 57Ini juga bekerja pada struktur data bertingkat:
58 58
59```yuescript 59```yuescript
60obj2 = { 60obj2 = {
@@ -85,7 +85,7 @@ print first, second, color
85 85
86</YueDisplay> 86</YueDisplay>
87 87
88If the destructuring statement is complicated, feel free to spread it out over a few lines. A slightly more complicated example: 88Jika pernyataan destrukturisasi kompleks, Anda bisa memecahnya ke beberapa baris. Contoh yang sedikit lebih rumit:
89 89
90```yuescript 90```yuescript
91{ 91{
@@ -108,7 +108,7 @@ If the destructuring statement is complicated, feel free to spread it out over a
108 108
109</YueDisplay> 109</YueDisplay>
110 110
111It's common to extract values from at table and assign them the local variables that have the same name as the key. In order to avoid repetition we can use the **:** prefix operator: 111Umumnya mengekstrak nilai dari tabel lalu menugaskannya ke variabel local dengan nama yang sama dengan kuncinya. Untuk menghindari pengulangan, kita bisa menggunakan operator prefiks **:**:
112 112
113```yuescript 113```yuescript
114{:concat, :insert} = table 114{:concat, :insert} = table
@@ -121,7 +121,7 @@ It's common to extract values from at table and assign them the local variables
121 121
122</YueDisplay> 122</YueDisplay>
123 123
124This is effectively the same as import, but we can rename fields we want to extract by mixing the syntax: 124Ini secara efektif sama seperti import, tetapi kita dapat mengganti nama field yang ingin diekstrak dengan menggabungkan sintaks:
125 125
126```yuescript 126```yuescript
127{:mix, :max, random: rand} = math 127{:mix, :max, random: rand} = math
@@ -134,7 +134,7 @@ This is effectively the same as import, but we can rename fields we want to extr
134 134
135</YueDisplay> 135</YueDisplay>
136 136
137You can write default values while doing destructuring like: 137Anda bisa menulis nilai default saat destrukturisasi seperti:
138 138
139```yuescript 139```yuescript
140{:name = "nameless", :job = "jobless"} = person 140{:name = "nameless", :job = "jobless"} = person
@@ -147,7 +147,7 @@ You can write default values while doing destructuring like:
147 147
148</YueDisplay> 148</YueDisplay>
149 149
150You can use `_` as placeholder when doing a list destructuring: 150Anda dapat menggunakan `_` sebagai placeholder saat destrukturisasi list:
151 151
152```yuescript 152```yuescript
153[_, two, _, four] = items 153[_, two, _, four] = items
@@ -160,9 +160,9 @@ You can use `_` as placeholder when doing a list destructuring:
160 160
161</YueDisplay> 161</YueDisplay>
162 162
163## Range Destructuring 163## Destrukturisasi Rentang
164 164
165You can use the spread operator `...` in list destructuring to capture a range of values. This is useful when you want to extract specific elements from the beginning and end of a list while collecting the rest in between. 165Anda dapat menggunakan operator spread `...` pada destrukturisasi list untuk menangkap rentang nilai. Ini berguna ketika Anda ingin mengekstrak elemen tertentu dari awal dan akhir list sambil mengumpulkan sisanya di tengah.
166 166
167```yuescript 167```yuescript
168orders = ["first", "second", "third", "fourth", "last"] 168orders = ["first", "second", "third", "fourth", "last"]
@@ -183,36 +183,36 @@ print last -- prints: last
183 183
184</YueDisplay> 184</YueDisplay>
185 185
186The spread operator can be used in different positions to capture different ranges, and you can use `_` as a placeholder for the values you don't want to capture: 186Operator spread dapat digunakan pada posisi berbeda untuk menangkap rentang yang berbeda, dan Anda bisa memakai `_` sebagai placeholder untuk nilai yang tidak ingin ditangkap:
187 187
188```yuescript 188```yuescript
189-- Capture everything after first element 189-- Tangkap semuanya setelah elemen pertama
190[first, ...rest] = orders 190[first, ...rest] = orders
191 191
192-- Capture everything before last element 192-- Tangkap semuanya sebelum elemen terakhir
193[...start, last] = orders 193[...start, last] = orders
194 194
195-- Capture things except the middle elements 195-- Tangkap semuanya kecuali elemen tengah
196[first, ..._, last] = orders 196[first, ..._, last] = orders
197``` 197```
198<YueDisplay> 198<YueDisplay>
199 199
200```yue 200```yue
201-- Capture everything after first element 201-- Tangkap semuanya setelah elemen pertama
202[first, ...rest] = orders 202[first, ...rest] = orders
203 203
204-- Capture everything before last element 204-- Tangkap semuanya sebelum elemen terakhir
205[...start, last] = orders 205[...start, last] = orders
206 206
207-- Capture things except the middle elements 207-- Tangkap semuanya kecuali elemen tengah
208[first, ..._, last] = orders 208[first, ..._, last] = orders
209``` 209```
210 210
211</YueDisplay> 211</YueDisplay>
212 212
213## Destructuring In Other Places 213## Destrukturisasi di Tempat Lain
214 214
215Destructuring can also show up in places where an assignment implicitly takes place. An example of this is a for loop: 215Destrukturisasi juga dapat muncul di tempat-tempat di mana assignment terjadi secara implisit. Contohnya adalah perulangan for:
216 216
217```yuescript 217```yuescript
218tuples = [ 218tuples = [
@@ -237,4 +237,4 @@ for [left, right] in *tuples
237 237
238</YueDisplay> 238</YueDisplay>
239 239
240We know each element in the array table is a two item tuple, so we can unpack it directly in the names clause of the for statement using a destructure. 240Kita tahu setiap elemen pada tabel array adalah tuple dua item, sehingga kita dapat membongkarnya langsung di klausa nama pada pernyataan for menggunakan destrukturisasi.
diff --git a/doc/docs/id-id/doc/assignment/if-assignment.md b/doc/docs/id-id/doc/assignment/if-assignment.md
index 02984e8..b30d0d9 100644
--- a/doc/docs/id-id/doc/assignment/if-assignment.md
+++ b/doc/docs/id-id/doc/assignment/if-assignment.md
@@ -1,6 +1,6 @@
1# If Assignment 1# Penugasan pada If
2 2
3`if` and `elseif` blocks can take an assignment in place of a conditional expression. Upon evaluating the conditional, the assignment will take place and the value that was assigned to will be used as the conditional expression. The assigned variable is only in scope for the body of the conditional, meaning it is never available if the value is not truthy. And you have to use "the walrus operator" `:=` instead of `=` to do assignment. 3Blok `if` dan `elseif` dapat menerima assignment sebagai ganti ekspresi kondisional. Saat kondisi dievaluasi, assignment akan dilakukan dan nilai yang di-assign akan digunakan sebagai ekspresi kondisional. Variabel yang di-assign hanya berada dalam scope badan kondisional, artinya tidak pernah tersedia jika nilai tidak truthy. Dan Anda harus menggunakan "walrus operator" `:=` sebagai ganti `=` untuk melakukan assignment.
4 4
5```yuescript 5```yuescript
6if user := database.find_user "moon" 6if user := database.find_user "moon"
@@ -36,36 +36,36 @@ else
36 36
37</YueDisplay> 37</YueDisplay>
38 38
39If assignment with multiple return values. Only the first value is getting checked, other values are scoped. 39Assignment if dengan beberapa nilai return. Hanya nilai pertama yang dicek, nilai lainnya tetap berada dalam scope.
40```yuescript 40```yuescript
41if success, result := pcall -> "get result without problems" 41if success, result := pcall -> "get result without problems"
42 print result -- variable result is scoped 42 print result -- variabel result berada dalam scope
43print "OK" 43print "OK"
44``` 44```
45<YueDisplay> 45<YueDisplay>
46 46
47```yue 47```yue
48if success, result := pcall -> "get result without problems" 48if success, result := pcall -> "get result without problems"
49 print result -- variable result is scoped 49 print result -- variabel result berada dalam scope
50print "OK" 50print "OK"
51``` 51```
52 52
53</YueDisplay> 53</YueDisplay>
54 54
55## While Assignment 55## Assignment pada While
56 56
57You can also use if assignment in a while loop to get the value as the loop condition. 57Anda juga bisa menggunakan assignment if di loop while untuk mendapatkan nilai sebagai kondisi loop.
58 58
59```yuescript 59```yuescript
60while byte := stream\read_one! 60while byte := stream\read_one!
61 -- do something with the byte 61 -- lakukan sesuatu dengan byte
62 print byte 62 print byte
63``` 63```
64<YueDisplay> 64<YueDisplay>
65 65
66```yue 66```yue
67while byte := stream\read_one! 67while byte := stream\read_one!
68 -- do something with the byte 68 -- lakukan sesuatu dengan byte
69 print byte 69 print byte
70``` 70```
71 71
diff --git a/doc/docs/id-id/doc/assignment/the-using-clause-controlling-destructive-assignment.md b/doc/docs/id-id/doc/assignment/the-using-clause-controlling-destructive-assignment.md
index fb9b740..6953138 100644
--- a/doc/docs/id-id/doc/assignment/the-using-clause-controlling-destructive-assignment.md
+++ b/doc/docs/id-id/doc/assignment/the-using-clause-controlling-destructive-assignment.md
@@ -1,11 +1,11 @@
1# The Using Clause; Controlling Destructive Assignment 1# Klausa Using; Mengendalikan Penugasan Destruktif
2 2
3While lexical scoping can be a great help in reducing the complexity of the code we write, things can get unwieldy as the code size increases. Consider the following snippet: 3Meskipun scope leksikal sangat membantu mengurangi kompleksitas kode yang kita tulis, hal ini bisa menjadi sulit ketika ukuran kode membesar. Pertimbangkan cuplikan berikut:
4 4
5```yuescript 5```yuescript
6i = 100 6i = 100
7 7
8-- many lines of code... 8-- banyak baris kode...
9 9
10my_func = -> 10my_func = ->
11 i = 10 11 i = 10
@@ -15,14 +15,14 @@ my_func = ->
15 15
16my_func! 16my_func!
17 17
18print i -- will print 0 18print i -- akan mencetak 0
19``` 19```
20<YueDisplay> 20<YueDisplay>
21 21
22```yue 22```yue
23i = 100 23i = 100
24 24
25-- many lines of code... 25-- banyak baris kode...
26 26
27my_func = -> 27my_func = ->
28 i = 10 28 i = 10
@@ -32,25 +32,25 @@ my_func = ->
32 32
33my_func! 33my_func!
34 34
35print i -- will print 0 35print i -- akan mencetak 0
36``` 36```
37 37
38</YueDisplay> 38</YueDisplay>
39 39
40In my_func, we've overwritten the value of i mistakenly. In this example it is quite obvious, but consider a large, or foreign code base where it isn't clear what names have already been declared. 40Di `my_func`, kita tanpa sengaja menimpa nilai `i`. Dalam contoh ini halnya cukup jelas, tetapi bayangkan kode besar atau basis kode asing di mana tidak jelas nama apa saja yang sudah dideklarasikan.
41 41
42It would be helpful to say which variables from the enclosing scope we intend on change, in order to prevent us from changing others by accident. 42Akan sangat membantu jika kita dapat menyatakan variabel mana dari scope luar yang memang ingin kita ubah, agar mencegah mengubah yang lain secara tidak sengaja.
43 43
44The using keyword lets us do that. using nil makes sure that no closed variables are overwritten in assignment. The using clause is placed after the argument list in a function, or in place of it if there are no arguments. 44Kata kunci `using` memungkinkan kita melakukan itu. `using nil` memastikan bahwa tidak ada variabel tertutup yang ditimpa dalam assignment. Klausa `using` ditempatkan setelah daftar argumen pada fungsi, atau menggantikannya jika tidak ada argumen.
45 45
46```yuescript 46```yuescript
47i = 100 47i = 100
48 48
49my_func = (using nil) -> 49my_func = (using nil) ->
50 i = "hello" -- a new local variable is created here 50 i = "hello" -- variabel local baru dibuat di sini
51 51
52my_func! 52my_func!
53print i -- prints 100, i is unaffected 53print i -- mencetak 100, i tidak terpengaruh
54``` 54```
55<YueDisplay> 55<YueDisplay>
56 56
@@ -58,27 +58,27 @@ print i -- prints 100, i is unaffected
58i = 100 58i = 100
59 59
60my_func = (using nil) -> 60my_func = (using nil) ->
61 i = "hello" -- a new local variable is created here 61 i = "hello" -- variabel local baru dibuat di sini
62 62
63my_func! 63my_func!
64print i -- prints 100, i is unaffected 64print i -- mencetak 100, i tidak terpengaruh
65``` 65```
66 66
67</YueDisplay> 67</YueDisplay>
68 68
69Multiple names can be separated by commas. Closure values can still be accessed, they just cant be modified: 69Beberapa nama dapat dipisahkan dengan koma. Nilai closure tetap bisa diakses, hanya saja tidak dapat dimodifikasi:
70 70
71```yuescript 71```yuescript
72tmp = 1213 72tmp = 1213
73i, k = 100, 50 73i, k = 100, 50
74 74
75my_func = (add using k, i) -> 75my_func = (add using k, i) ->
76 tmp = tmp + add -- a new local tmp is created 76 tmp = tmp + add -- tmp local baru dibuat
77 i += tmp 77 i += tmp
78 k += tmp 78 k += tmp
79 79
80my_func(22) 80my_func(22)
81print i, k -- these have been updated 81print i, k -- ini telah diperbarui
82``` 82```
83<YueDisplay> 83<YueDisplay>
84 84
@@ -87,12 +87,12 @@ tmp = 1213
87i, k = 100, 50 87i, k = 100, 50
88 88
89my_func = (add using k, i) -> 89my_func = (add using k, i) ->
90 tmp = tmp + add -- a new local tmp is created 90 tmp = tmp + add -- tmp local baru dibuat
91 i += tmp 91 i += tmp
92 k += tmp 92 k += tmp
93 93
94my_func(22) 94my_func(22)
95print i, k -- these have been updated 95print i, k -- ini telah diperbarui
96``` 96```
97 97
98</YueDisplay> 98</YueDisplay>
diff --git a/doc/docs/id-id/doc/assignment/varargs-assignment.md b/doc/docs/id-id/doc/assignment/varargs-assignment.md
index 1d66680..f24652f 100644
--- a/doc/docs/id-id/doc/assignment/varargs-assignment.md
+++ b/doc/docs/id-id/doc/assignment/varargs-assignment.md
@@ -1,6 +1,6 @@
1# Varargs Assignment 1# Penugasan Varargs
2 2
3You can assign the results returned from a function to a varargs symbol `...`. And then access its content using the Lua way. 3Anda dapat meng-assign hasil yang dikembalikan dari sebuah fungsi ke simbol varargs `...`. Lalu akses isinya menggunakan cara Lua.
4 4
5```yuescript 5```yuescript
6list = [1, 2, 3, 4, 5] 6list = [1, 2, 3, 4, 5]
diff --git a/doc/docs/id-id/doc/control-flow/conditionals.md b/doc/docs/id-id/doc/control-flow/conditionals.md
index 5ba81cf..4f08b16 100644
--- a/doc/docs/id-id/doc/control-flow/conditionals.md
+++ b/doc/docs/id-id/doc/control-flow/conditionals.md
@@ -1,55 +1,55 @@
1# Conditionals 1# Kondisional
2 2
3```yuescript 3```yuescript
4have_coins = false 4have_coins = false
5if have_coins 5if have_coins
6 print "Got coins" 6 print "Dapat koin"
7else 7else
8 print "No coins" 8 print "Tidak ada koin"
9``` 9```
10<YueDisplay> 10<YueDisplay>
11 11
12```yue 12```yue
13have_coins = false 13have_coins = false
14if have_coins 14if have_coins
15 print "Got coins" 15 print "Dapat koin"
16else 16else
17 print "No coins" 17 print "Tidak ada koin"
18``` 18```
19 19
20</YueDisplay> 20</YueDisplay>
21 21
22A short syntax for single statements can also be used: 22Sintaks pendek untuk pernyataan tunggal juga bisa digunakan:
23 23
24```yuescript 24```yuescript
25have_coins = false 25have_coins = false
26if have_coins then print "Got coins" else print "No coins" 26if have_coins then print "Dapat koin" else print "Tidak ada koin"
27``` 27```
28<YueDisplay> 28<YueDisplay>
29 29
30```yue 30```yue
31have_coins = false 31have_coins = false
32if have_coins then print "Got coins" else print "No coins" 32if have_coins then print "Dapat koin" else print "Tidak ada koin"
33``` 33```
34 34
35</YueDisplay> 35</YueDisplay>
36 36
37Because if statements can be used as expressions, this can also be written as: 37Karena pernyataan if dapat digunakan sebagai ekspresi, ini juga bisa ditulis sebagai:
38 38
39```yuescript 39```yuescript
40have_coins = false 40have_coins = false
41print if have_coins then "Got coins" else "No coins" 41print if have_coins then "Dapat koin" else "Tidak ada koin"
42``` 42```
43<YueDisplay> 43<YueDisplay>
44 44
45```yue 45```yue
46have_coins = false 46have_coins = false
47print if have_coins then "Got coins" else "No coins" 47print if have_coins then "Dapat koin" else "Tidak ada koin"
48``` 48```
49 49
50</YueDisplay> 50</YueDisplay>
51 51
52Conditionals can also be used in return statements and assignments: 52Kondisional juga bisa digunakan di pernyataan return dan assignment:
53 53
54```yuescript 54```yuescript
55is_tall = (name) -> 55is_tall = (name) ->
@@ -59,11 +59,11 @@ is_tall = (name) ->
59 false 59 false
60 60
61message = if is_tall "Rob" 61message = if is_tall "Rob"
62 "I am very tall" 62 "Saya sangat tinggi"
63else 63else
64 "I am not so tall" 64 "Saya tidak terlalu tinggi"
65 65
66print message -- prints: I am very tall 66print message -- prints: Saya sangat tinggi
67``` 67```
68<YueDisplay> 68<YueDisplay>
69 69
@@ -75,53 +75,53 @@ is_tall = (name) ->
75 false 75 false
76 76
77message = if is_tall "Rob" 77message = if is_tall "Rob"
78 "I am very tall" 78 "Saya sangat tinggi"
79else 79else
80 "I am not so tall" 80 "Saya tidak terlalu tinggi"
81 81
82print message -- prints: I am very tall 82print message -- prints: Saya sangat tinggi
83``` 83```
84 84
85</YueDisplay> 85</YueDisplay>
86 86
87The opposite of if is unless: 87Kebalikan dari if adalah unless:
88 88
89```yuescript 89```yuescript
90unless os.date("%A") == "Monday" 90unless os.date("%A") == "Monday"
91 print "it is not Monday!" 91 print "hari ini bukan Senin!"
92``` 92```
93<YueDisplay> 93<YueDisplay>
94 94
95```yue 95```yue
96unless os.date("%A") == "Monday" 96unless os.date("%A") == "Monday"
97 print "it is not Monday!" 97 print "hari ini bukan Senin!"
98``` 98```
99 99
100</YueDisplay> 100</YueDisplay>
101 101
102```yuescript 102```yuescript
103print "You're lucky!" unless math.random! > 0.1 103print "Kamu beruntung!" unless math.random! > 0.1
104``` 104```
105<YueDisplay> 105<YueDisplay>
106 106
107```yue 107```yue
108print "You're lucky!" unless math.random! > 0.1 108print "Kamu beruntung!" unless math.random! > 0.1
109``` 109```
110 110
111</YueDisplay> 111</YueDisplay>
112 112
113## In Expression 113## Ekspresi In
114 114
115You can write range checking code with an `in-expression`. 115Anda dapat menulis kode pengecekan rentang dengan `ekspresi in`.
116 116
117```yuescript 117```yuescript
118a = 5 118a = 5
119 119
120if a in [1, 3, 5, 7] 120if a in [1, 3, 5, 7]
121 print "checking equality with discrete values" 121 print "memeriksa kesamaan dengan nilai-nilai diskrit"
122 122
123if a in list 123if a in list
124 print "checking if `a` is in a list" 124 print "memeriksa apakah `a` ada di dalam daftar"
125``` 125```
126<YueDisplay> 126<YueDisplay>
127 127
@@ -129,21 +129,10 @@ if a in list
129a = 5 129a = 5
130 130
131if a in [1, 3, 5, 7] 131if a in [1, 3, 5, 7]
132 print "checking equality with discrete values" 132 print "memeriksa kesamaan dengan nilai-nilai diskrit"
133 133
134if a in list 134if a in list
135 print "checking if `a` is in a list" 135 print "memeriksa apakah `a` ada di dalam daftar"
136```
137
138</YueDisplay>
139
140```yuescript
141print "You're lucky!" unless math.random! > 0.1
142```
143<YueDisplay>
144
145```yue
146print "You're lucky!" unless math.random! > 0.1
147``` 136```
148 137
149</YueDisplay> 138</YueDisplay>
diff --git a/doc/docs/id-id/doc/control-flow/continue.md b/doc/docs/id-id/doc/control-flow/continue.md
index b000765..3d7a68c 100644
--- a/doc/docs/id-id/doc/control-flow/continue.md
+++ b/doc/docs/id-id/doc/control-flow/continue.md
@@ -1,6 +1,6 @@
1# Continue 1# Pernyataan Continue
2 2
3A continue statement can be used to skip the current iteration in a loop. 3Pernyataan continue dapat digunakan untuk melewati iterasi saat ini di dalam loop.
4 4
5```yuescript 5```yuescript
6i = 0 6i = 0
@@ -21,7 +21,7 @@ while i < 10
21 21
22</YueDisplay> 22</YueDisplay>
23 23
24continue can also be used with loop expressions to prevent that iteration from accumulating into the result. This examples filters the array table into just even numbers: 24continue juga bisa digunakan bersama ekspresi loop untuk mencegah iterasi tersebut diakumulasikan ke hasil. Contoh ini memfilter tabel array menjadi hanya angka genap:
25 25
26```yuescript 26```yuescript
27my_numbers = [1, 2, 3, 4, 5, 6] 27my_numbers = [1, 2, 3, 4, 5, 6]
diff --git a/doc/docs/id-id/doc/control-flow/for-loop.md b/doc/docs/id-id/doc/control-flow/for-loop.md
index cabcde5..91ba22e 100644
--- a/doc/docs/id-id/doc/control-flow/for-loop.md
+++ b/doc/docs/id-id/doc/control-flow/for-loop.md
@@ -1,6 +1,6 @@
1# For Loop 1# Perulangan For
2 2
3There are two for loop forms, just like in Lua. A numeric one and a generic one: 3Ada dua bentuk perulangan for, seperti di Lua. Satu numerik dan satu generik:
4 4
5```yuescript 5```yuescript
6for i = 10, 20 6for i = 10, 20
@@ -27,7 +27,7 @@ for key, value in pairs object
27 27
28</YueDisplay> 28</YueDisplay>
29 29
30The slicing and **\*** operators can be used, just like with comprehensions: 30Operator slicing dan **\*** dapat digunakan, seperti pada comprehension:
31 31
32```yuescript 32```yuescript
33for item in *items[2, 4] 33for item in *items[2, 4]
@@ -42,7 +42,7 @@ for item in *items[2, 4]
42 42
43</YueDisplay> 43</YueDisplay>
44 44
45A shorter syntax is also available for all variations when the body is only a single line: 45Sintaks yang lebih singkat juga tersedia untuk semua variasi ketika badan hanya satu baris:
46 46
47```yuescript 47```yuescript
48for item in *items do print item 48for item in *items do print item
@@ -59,9 +59,9 @@ for j = 1, 10, 3 do print j
59 59
60</YueDisplay> 60</YueDisplay>
61 61
62A for loop can also be used as an expression. The last statement in the body of the for loop is coerced into an expression and appended to an accumulating array table. 62Perulangan for juga bisa digunakan sebagai ekspresi. Pernyataan terakhir di badan for dipaksa menjadi ekspresi dan ditambahkan ke tabel array yang terakumulasi.
63 63
64Doubling every even number: 64Menggandakan setiap bilangan genap:
65 65
66```yuescript 66```yuescript
67doubled_evens = for i = 1, 20 67doubled_evens = for i = 1, 20
@@ -82,9 +82,9 @@ doubled_evens = for i = 1, 20
82 82
83</YueDisplay> 83</YueDisplay>
84 84
85In addition, for loops support break with a return value, allowing the loop itself to be used as an expression that exits early with a meaningful result. 85Selain itu, loop for mendukung break dengan nilai kembalian, sehingga loop itu sendiri bisa dipakai sebagai ekspresi yang keluar lebih awal dengan hasil bermakna.
86 86
87For example, to find the first number greater than 10: 87Contohnya, untuk menemukan angka pertama yang lebih besar dari 10:
88 88
89```yuescript 89```yuescript
90first_large = for n in *numbers 90first_large = for n in *numbers
@@ -99,11 +99,11 @@ first_large = for n in *numbers
99 99
100</YueDisplay> 100</YueDisplay>
101 101
102This break-with-value syntax enables concise and expressive search or early-exit patterns directly within loop expressions. 102Sintaks break-dengan-nilai ini memungkinkan pola pencarian atau keluar-lebih-awal yang ringkas langsung di dalam ekspresi loop.
103 103
104You can also filter values by combining the for loop expression with the continue statement. 104Anda juga bisa memfilter nilai dengan menggabungkan ekspresi for dengan pernyataan continue.
105 105
106For loops at the end of a function body are not accumulated into a table for a return value (Instead the function will return nil). Either an explicit return statement can be used, or the loop can be converted into a list comprehension. 106Loop for di akhir badan fungsi tidak diakumulasikan menjadi tabel untuk nilai kembalian (sebaliknya fungsi akan mengembalikan nil). Gunakan pernyataan return eksplisit, atau ubah loop menjadi list comprehension.
107 107
108```yuescript 108```yuescript
109func_a = -> for i = 1, 10 do print i 109func_a = -> for i = 1, 10 do print i
@@ -123,5 +123,3 @@ print func_b! -- prints table object
123``` 123```
124 124
125</YueDisplay> 125</YueDisplay>
126
127This is done to avoid the needless creation of tables for functions that don't need to return the results of the loop.
diff --git a/doc/docs/id-id/doc/control-flow/switch.md b/doc/docs/id-id/doc/control-flow/switch.md
index f503a80..ced4748 100644
--- a/doc/docs/id-id/doc/control-flow/switch.md
+++ b/doc/docs/id-id/doc/control-flow/switch.md
@@ -1,6 +1,6 @@
1# Switch 1# Pernyataan Switch
2 2
3The switch statement is shorthand for writing a series of if statements that check against the same value. Note that the value is only evaluated once. Like if statements, switches can have an else block to handle no matches. Comparison is done with the == operator. In switch statement, you can also use assignment expression to store temporary variable value. 3Pernyataan switch adalah bentuk singkat untuk menulis serangkaian if yang membandingkan nilai yang sama. Perhatikan bahwa nilainya hanya dievaluasi sekali. Seperti if, switch bisa memiliki blok else untuk menangani tidak ada yang cocok. Perbandingan dilakukan dengan operator `==`. Di dalam switch, Anda juga bisa memakai ekspresi assignment untuk menyimpan nilai variabel sementara.
4 4
5```yuescript 5```yuescript
6switch name := "Dan" 6switch name := "Dan"
@@ -25,9 +25,9 @@ switch name := "Dan"
25 25
26</YueDisplay> 26</YueDisplay>
27 27
28A switch when clause can match against multiple values by listing them out comma separated. 28Klausa when pada switch bisa mencocokkan beberapa nilai dengan menuliskannya dipisah koma.
29 29
30Switches can be used as expressions as well, here we can assign the result of the switch to a variable: 30Switch juga bisa dipakai sebagai ekspresi; di sini kita dapat menetapkan hasil switch ke sebuah variabel:
31 31
32```yuescript 32```yuescript
33b = 1 33b = 1
@@ -54,7 +54,7 @@ next_number = switch b
54 54
55</YueDisplay> 55</YueDisplay>
56 56
57We can use the then keyword to write a switch's when block on a single line. No extra keyword is needed to write the else block on a single line. 57Kita bisa memakai kata kunci `then` untuk menulis blok when switch pada satu baris. Tidak ada kata kunci tambahan yang dibutuhkan untuk menulis blok else pada satu baris.
58 58
59```yuescript 59```yuescript
60msg = switch math.random(1, 5) 60msg = switch math.random(1, 5)
@@ -73,7 +73,7 @@ msg = switch math.random(1, 5)
73 73
74</YueDisplay> 74</YueDisplay>
75 75
76If you want to write code with one less indent when writing a switch statement, you can put the first when clause on the statement start line, and then all other clauses can be written with one less indent. 76Jika Anda ingin menulis kode dengan satu indentasi lebih sedikit saat menulis switch, Anda bisa menaruh klausa when pertama pada baris awal pernyataan, lalu semua klausa lain dapat ditulis dengan satu indentasi lebih sedikit.
77 77
78```yuescript 78```yuescript
79switch math.random(1, 5) 79switch math.random(1, 5)
@@ -104,11 +104,11 @@ else
104 104
105</YueDisplay> 105</YueDisplay>
106 106
107It is worth noting the order of the case comparison expression. The case's expression is on the left hand side. This can be useful if the case's expression wants to overwrite how the comparison is done by defining an eq metamethod. 107Perlu dicatat urutan ekspresi perbandingan kasus. Ekspresi kasus berada di sisi kiri. Ini bisa berguna jika ekspresi kasus ingin mengganti cara perbandingan dengan mendefinisikan metamethod `eq`.
108 108
109## Table Matching 109## Pencocokan Tabel
110 110
111You can do table matching in a switch when clause, if the table can be destructured by a specific structure and get non-nil values. 111Anda bisa melakukan pencocokan tabel dalam klausa when switch, jika tabel dapat didestrukturisasi oleh struktur tertentu dan mendapatkan nilai non-nil.
112 112
113```yuescript 113```yuescript
114items = 114items =
@@ -143,7 +143,7 @@ for item in *items
143 143
144</YueDisplay> 144</YueDisplay>
145 145
146You can use default values to optionally destructure the table for some fields. 146Anda dapat menggunakan nilai default untuk mendestrukturisasi tabel secara opsional pada beberapa field.
147 147
148```yuescript 148```yuescript
149item = {} 149item = {}
@@ -168,9 +168,9 @@ switch item
168 168
169</YueDisplay> 169</YueDisplay>
170 170
171You can also match against array elements, table fields, and even nested structures with array or table literals. 171Anda juga bisa mencocokkan elemen array, field tabel, dan bahkan struktur bertingkat dengan literal array atau tabel.
172 172
173Match against array elements. 173Cocokkan terhadap elemen array.
174 174
175```yuescript 175```yuescript
176switch tb 176switch tb
@@ -195,7 +195,7 @@ switch tb
195 195
196</YueDisplay> 196</YueDisplay>
197 197
198Match against table fields with destructuring. 198Cocokkan terhadap field tabel dengan destrukturisasi.
199 199
200```yuescript 200```yuescript
201switch tb 201switch tb
@@ -220,7 +220,7 @@ switch tb
220 220
221</YueDisplay> 221</YueDisplay>
222 222
223Match against nested table structures. 223Cocokkan terhadap struktur tabel bertingkat.
224 224
225```yuescript 225```yuescript
226switch tb 226switch tb
@@ -245,7 +245,7 @@ switch tb
245 245
246</YueDisplay> 246</YueDisplay>
247 247
248Match against array of tables. 248Cocokkan terhadap array dari tabel.
249 249
250```yuescript 250```yuescript
251switch tb 251switch tb
@@ -272,7 +272,7 @@ switch tb
272 272
273</YueDisplay> 273</YueDisplay>
274 274
275Match against a list and capture a range of elements. 275Cocokkan terhadap daftar dan tangkap rentang elemen.
276 276
277```yuescript 277```yuescript
278segments = ["admin", "users", "logs", "view"] 278segments = ["admin", "users", "logs", "view"]
diff --git a/doc/docs/id-id/doc/control-flow/while-loop.md b/doc/docs/id-id/doc/control-flow/while-loop.md
index 502935e..cd93c91 100644
--- a/doc/docs/id-id/doc/control-flow/while-loop.md
+++ b/doc/docs/id-id/doc/control-flow/while-loop.md
@@ -1,6 +1,6 @@
1# While Loop 1# Perulangan While
2 2
3The while loop also comes in four variations: 3Perulangan while juga memiliki empat variasi:
4 4
5```yuescript 5```yuescript
6i = 10 6i = 10
@@ -43,11 +43,11 @@ until running == false do my_function!
43 43
44</YueDisplay> 44</YueDisplay>
45 45
46Like for loops, the while loop can also be used an expression. Additionally, for a function to return the accumulated value of a while loop, the statement must be explicitly returned. 46Seperti loop for, loop while juga bisa digunakan sebagai ekspresi. Selain itu, agar sebuah fungsi mengembalikan nilai akumulasi dari loop while, pernyataannya harus di-return secara eksplisit.
47 47
48## Repeat Loop 48## Repeat Loop
49 49
50The repeat loop comes from Lua: 50Loop repeat berasal dari Lua:
51 51
52```yuescript 52```yuescript
53i = 10 53i = 10
diff --git a/doc/docs/id-id/doc/data-structures/comprehensions.md b/doc/docs/id-id/doc/data-structures/comprehensions.md
index 3a92167..3a2a9ff 100644
--- a/doc/docs/id-id/doc/data-structures/comprehensions.md
+++ b/doc/docs/id-id/doc/data-structures/comprehensions.md
@@ -1,10 +1,10 @@
1# Comprehensions 1# Komprehensi
2 2
3Comprehensions provide a convenient syntax for constructing a new table by iterating over some existing object and applying an expression to its values. There are two kinds of comprehensions: list comprehensions and table comprehensions. They both produce Lua tables; list comprehensions accumulate values into an array-like table, and table comprehensions let you set both the key and the value on each iteration. 3Komprehensi menyediakan sintaks yang nyaman untuk membangun tabel baru dengan mengiterasi objek yang ada dan menerapkan ekspresi pada nilainya. Ada dua jenis komprehensi: komprehensi list dan komprehensi tabel. Keduanya menghasilkan tabel Lua; komprehensi list mengakumulasi nilai ke tabel mirip array, dan komprehensi tabel memungkinkan Anda menetapkan kunci dan nilai pada setiap iterasi.
4 4
5## List Comprehensions 5## Komprehensi List
6 6
7The following creates a copy of the items table but with all the values doubled. 7Berikut membuat salinan tabel `items` tetapi semua nilainya digandakan.
8 8
9```yuescript 9```yuescript
10items = [ 1, 2, 3, 4 ] 10items = [ 1, 2, 3, 4 ]
@@ -19,7 +19,7 @@ doubled = [item * 2 for i, item in ipairs items]
19 19
20</YueDisplay> 20</YueDisplay>
21 21
22The items included in the new table can be restricted with a when clause: 22Item yang disertakan dalam tabel baru bisa dibatasi dengan klausa `when`:
23 23
24```yuescript 24```yuescript
25slice = [item for i, item in ipairs items when i > 1 and i < 3] 25slice = [item for i, item in ipairs items when i > 1 and i < 3]
@@ -32,7 +32,7 @@ slice = [item for i, item in ipairs items when i > 1 and i < 3]
32 32
33</YueDisplay> 33</YueDisplay>
34 34
35Because it is common to iterate over the values of a numerically indexed table, an **\*** operator is introduced. The doubled example can be rewritten as: 35Karena umum untuk mengiterasi nilai dari tabel berindeks numerik, operator **\*** diperkenalkan. Contoh `doubled` bisa ditulis ulang sebagai:
36 36
37```yuescript 37```yuescript
38doubled = [item * 2 for item in *items] 38doubled = [item * 2 for item in *items]
@@ -45,7 +45,7 @@ doubled = [item * 2 for item in *items]
45 45
46</YueDisplay> 46</YueDisplay>
47 47
48In list comprehensions, you can also use the spread operator `...` to flatten nested lists, achieving a flat map effect: 48Dalam komprehensi list, Anda juga bisa menggunakan operator spread `...` untuk meratakan list bertingkat, menghasilkan efek flat map:
49 49
50```yuescript 50```yuescript
51data = 51data =
@@ -53,7 +53,7 @@ data =
53 b: [4, 5, 6] 53 b: [4, 5, 6]
54 54
55flat = [...v for k,v in pairs data] 55flat = [...v for k,v in pairs data]
56-- flat is now [1, 2, 3, 4, 5, 6] 56-- flat sekarang [1, 2, 3, 4, 5, 6]
57``` 57```
58<YueDisplay> 58<YueDisplay>
59 59
@@ -63,14 +63,14 @@ data =
63 b: [4, 5, 6] 63 b: [4, 5, 6]
64 64
65flat = [...v for k,v in pairs data] 65flat = [...v for k,v in pairs data]
66-- flat is now [1, 2, 3, 4, 5, 6] 66-- flat sekarang [1, 2, 3, 4, 5, 6]
67``` 67```
68 68
69</YueDisplay> 69</YueDisplay>
70 70
71The for and when clauses can be chained as much as desired. The only requirement is that a comprehension has at least one for clause. 71Klausa `for` dan `when` dapat dirantai sebanyak yang diinginkan. Satu-satunya syarat adalah komprehensi memiliki setidaknya satu klausa `for`.
72 72
73Using multiple for clauses is the same as using nested loops: 73Menggunakan beberapa klausa `for` sama seperti menggunakan loop bertingkat:
74 74
75```yuescript 75```yuescript
76x_coords = [4, 5, 6, 7] 76x_coords = [4, 5, 6, 7]
@@ -91,7 +91,7 @@ for y in *y_coords]
91 91
92</YueDisplay> 92</YueDisplay>
93 93
94Numeric for loops can also be used in comprehensions: 94Perulangan for numerik juga bisa digunakan dalam komprehensi:
95 95
96```yuescript 96```yuescript
97evens = [i for i = 1, 100 when i % 2 == 0] 97evens = [i for i = 1, 100 when i % 2 == 0]
@@ -104,11 +104,11 @@ evens = [i for i = 1, 100 when i % 2 == 0]
104 104
105</YueDisplay> 105</YueDisplay>
106 106
107## Table Comprehensions 107## Komprehensi Tabel
108 108
109The syntax for table comprehensions is very similar, only differing by using **{** and **}** and taking two values from each iteration. 109Sintaks untuk komprehensi tabel sangat mirip, hanya berbeda dengan penggunaan **{** dan **}** serta mengambil dua nilai dari setiap iterasi.
110 110
111This example makes a copy of the tablething: 111Contoh ini membuat salinan tabel `thing`:
112 112
113```yuescript 113```yuescript
114thing = { 114thing = {
@@ -144,7 +144,7 @@ no_color = {k, v for k, v in pairs thing when k != "color"}
144 144
145</YueDisplay> 145</YueDisplay>
146 146
147The **\*** operator is also supported. Here we create a square root look up table for a few numbers. 147Operator **\*** juga didukung. Di sini kita membuat tabel lookup akar kuadrat untuk beberapa angka.
148 148
149```yuescript 149```yuescript
150numbers = [1, 2, 3, 4] 150numbers = [1, 2, 3, 4]
@@ -159,9 +159,9 @@ sqrts = {i, math.sqrt i for i in *numbers}
159 159
160</YueDisplay> 160</YueDisplay>
161 161
162The key-value tuple in a table comprehension can also come from a single expression, in which case the expression should return two values. The first is used as the key and the second is used as the value: 162Tuple key-value dalam komprehensi tabel juga bisa berasal dari satu ekspresi, yang berarti ekspresi tersebut harus mengembalikan dua nilai. Nilai pertama digunakan sebagai kunci dan nilai kedua digunakan sebagai nilai:
163 163
164In this example we convert an array of pairs to a table where the first item in the pair is the key and the second is the value. 164Dalam contoh ini kita mengonversi array pasangan menjadi tabel di mana item pertama dalam pasangan menjadi kunci dan item kedua menjadi nilai.
165 165
166```yuescript 166```yuescript
167tuples = [ ["hello", "world"], ["foo", "bar"]] 167tuples = [ ["hello", "world"], ["foo", "bar"]]
@@ -178,9 +178,9 @@ tbl = {unpack tuple for tuple in *tuples}
178 178
179## Slicing 179## Slicing
180 180
181A special syntax is provided to restrict the items that are iterated over when using the **\*** operator. This is equivalent to setting the iteration bounds and a step size in a for loop. 181Sintaks khusus disediakan untuk membatasi item yang diiterasi saat menggunakan operator **\***. Ini setara dengan mengatur batas iterasi dan ukuran langkah pada loop for.
182 182
183Here we can set the minimum and maximum bounds, taking all items with indexes between 1 and 5 inclusive: 183Di sini kita bisa menetapkan batas minimum dan maksimum, mengambil semua item dengan indeks antara 1 dan 5 (inklusif):
184 184
185```yuescript 185```yuescript
186slice = [item for item in *items[1, 5]] 186slice = [item for item in *items[1, 5]]
@@ -193,7 +193,7 @@ slice = [item for item in *items[1, 5]]
193 193
194</YueDisplay> 194</YueDisplay>
195 195
196Any of the slice arguments can be left off to use a sensible default. In this example, if the max index is left off it defaults to the length of the table. This will take everything but the first element: 196Salah satu argumen slice boleh dikosongkan untuk menggunakan default yang masuk akal. Pada contoh ini, jika indeks maksimum dikosongkan, defaultnya adalah panjang tabel. Ini akan mengambil semua item kecuali elemen pertama:
197 197
198```yuescript 198```yuescript
199slice = [item for item in *items[2,]] 199slice = [item for item in *items[2,]]
@@ -206,7 +206,7 @@ slice = [item for item in *items[2,]]
206 206
207</YueDisplay> 207</YueDisplay>
208 208
209If the minimum bound is left out, it defaults to 1. Here we only provide a step size and leave the other bounds blank. This takes all odd indexed items: (1, 3, 5, …) 209Jika batas minimum dikosongkan, defaultnya adalah 1. Di sini kita hanya memberikan ukuran langkah dan membiarkan batas lainnya kosong. Ini akan mengambil semua item berindeks ganjil: (1, 3, 5, …)
210 210
211```yuescript 211```yuescript
212slice = [item for item in *items[,,2]] 212slice = [item for item in *items[,,2]]
@@ -219,22 +219,22 @@ slice = [item for item in *items[,,2]]
219 219
220</YueDisplay> 220</YueDisplay>
221 221
222Both the minimum and maximum bounds can be negative, which means that the bounds are counted from the end of the table. 222Batas minimum dan maksimum bisa bernilai negatif, yang berarti batas dihitung dari akhir tabel.
223 223
224```yuescript 224```yuescript
225-- take the last 4 items 225-- ambil 4 item terakhir
226slice = [item for item in *items[-4,-1]] 226slice = [item for item in *items[-4,-1]]
227``` 227```
228<YueDisplay> 228<YueDisplay>
229 229
230```yue 230```yue
231-- take the last 4 items 231-- ambil 4 item terakhir
232slice = [item for item in *items[-4,-1]] 232slice = [item for item in *items[-4,-1]]
233``` 233```
234 234
235</YueDisplay> 235</YueDisplay>
236 236
237The step size can also be negative, which means that the items are taken in reverse order. 237Ukuran langkah juga bisa negatif, yang berarti item diambil dalam urutan terbalik.
238 238
239```yuescript 239```yuescript
240reverse_slice = [item for item in *items[-1,1,-1]] 240reverse_slice = [item for item in *items[-1,1,-1]]
@@ -247,24 +247,24 @@ reverse_slice = [item for item in *items[-1,1,-1]]
247 247
248</YueDisplay> 248</YueDisplay>
249 249
250### Slicing Expression 250### Ekspresi Slicing
251 251
252Slicing can also be used as an expression. This is useful for getting a sub-list of a table. 252Slicing juga bisa digunakan sebagai ekspresi. Ini berguna untuk mendapatkan sub-list dari sebuah tabel.
253 253
254```yuescript 254```yuescript
255-- take the 2nd and 4th items as a new list 255-- ambil item ke-2 dan ke-4 sebagai list baru
256sub_list = items[2, 4] 256sub_list = items[2, 4]
257 257
258-- take the last 4 items 258-- ambil 4 item terakhir
259last_four_items = items[-4, -1] 259last_four_items = items[-4, -1]
260``` 260```
261<YueDisplay> 261<YueDisplay>
262 262
263```yue 263```yue
264-- take the 2nd and 4th items as a new list 264-- ambil item ke-2 dan ke-4 sebagai list baru
265sub_list = items[2, 4] 265sub_list = items[2, 4]
266 266
267-- take the last 4 items 267-- ambil 4 item terakhir
268last_four_items = items[-4, -1] 268last_four_items = items[-4, -1]
269``` 269```
270 270
diff --git a/doc/docs/id-id/doc/data-structures/table-literals.md b/doc/docs/id-id/doc/data-structures/table-literals.md
index c1adcab..df32f1c 100644
--- a/doc/docs/id-id/doc/data-structures/table-literals.md
+++ b/doc/docs/id-id/doc/data-structures/table-literals.md
@@ -1,6 +1,6 @@
1# Table Literals 1# Literal Tabel
2 2
3Like in Lua, tables are delimited in curly braces. 3Seperti di Lua, tabel dibatasi dengan kurung kurawal.
4 4
5```yuescript 5```yuescript
6some_values = [1, 2, 3, 4] 6some_values = [1, 2, 3, 4]
@@ -13,7 +13,7 @@ some_values = [1, 2, 3, 4]
13 13
14</YueDisplay> 14</YueDisplay>
15 15
16Unlike Lua, assigning a value to a key in a table is done with **:** (instead of **=**). 16Berbeda dengan Lua, assignment nilai ke sebuah kunci di tabel dilakukan dengan **:** (bukan **=**).
17 17
18```yuescript 18```yuescript
19some_values = { 19some_values = {
@@ -34,7 +34,7 @@ some_values = {
34 34
35</YueDisplay> 35</YueDisplay>
36 36
37The curly braces can be left off if a single table of key value pairs is being assigned. 37Kurung kurawal dapat dihilangkan jika hanya satu tabel pasangan key-value yang di-assign.
38 38
39```yuescript 39```yuescript
40profile = 40profile =
@@ -53,7 +53,7 @@ profile =
53 53
54</YueDisplay> 54</YueDisplay>
55 55
56Newlines can be used to delimit values instead of a comma (or both): 56Baris baru dapat digunakan untuk memisahkan nilai sebagai ganti koma (atau keduanya):
57 57
58```yuescript 58```yuescript
59values = { 59values = {
@@ -76,7 +76,7 @@ values = {
76 76
77</YueDisplay> 77</YueDisplay>
78 78
79When creating a single line table literal, the curly braces can also be left off: 79Saat membuat literal tabel satu baris, kurung kurawal juga bisa dihilangkan:
80 80
81```yuescript 81```yuescript
82my_function dance: "Tango", partner: "none" 82my_function dance: "Tango", partner: "none"
@@ -93,7 +93,7 @@ y = type: "dog", legs: 4, tails: 1
93 93
94</YueDisplay> 94</YueDisplay>
95 95
96The keys of a table literal can be language keywords without being escaped: 96Kunci literal tabel dapat berupa kata kunci bahasa tanpa perlu di-escape:
97 97
98```yuescript 98```yuescript
99tbl = { 99tbl = {
@@ -112,7 +112,7 @@ tbl = {
112 112
113</YueDisplay> 113</YueDisplay>
114 114
115If you are constructing a table out of variables and wish the keys to be the same as the variable names, then the **:** prefix operator can be used: 115Jika Anda membangun tabel dari variabel dan ingin kunci sama dengan nama variabel, maka operator prefiks **:** dapat digunakan:
116 116
117```yuescript 117```yuescript
118hair = "golden" 118hair = "golden"
@@ -133,7 +133,7 @@ print_table :hair, :height
133 133
134</YueDisplay> 134</YueDisplay>
135 135
136If you want the key of a field in the table to to be result of an expression, then you can wrap it in **[ ]**, just like in Lua. You can also use a string literal directly as a key, leaving out the square brackets. This is useful if your key has any special characters. 136Jika Anda ingin kunci field dalam tabel menjadi hasil suatu ekspresi, Anda dapat membungkusnya dengan **[ ]**, seperti di Lua. Anda juga bisa menggunakan literal string langsung sebagai kunci tanpa tanda kurung siku. Ini berguna jika kunci memiliki karakter khusus.
137 137
138```yuescript 138```yuescript
139t = { 139t = {
@@ -152,7 +152,7 @@ t = {
152 152
153</YueDisplay> 153</YueDisplay>
154 154
155Lua tables have both an array part and a hash part, but sometimes you want to make a semantic distinction between array and hash usage when writing Lua tables. Then you can write Lua table with **[ ]** instead of **{ }** to represent an array table and writing any key value pair in a list table won't be allowed. 155Tabel Lua memiliki bagian array dan bagian hash, tetapi terkadang Anda ingin membedakan penggunaan array dan hash secara semantik saat menulis tabel Lua. Maka Anda bisa menulis tabel Lua dengan **[ ]** alih-alih **{ }** untuk merepresentasikan tabel array, dan menuliskan pasangan key-value di tabel list tidak akan diizinkan.
156 156
157```yuescript 157```yuescript
158some_values = [1, 2, 3, 4] 158some_values = [1, 2, 3, 4]
diff --git a/doc/docs/id-id/doc/functions/backcalls.md b/doc/docs/id-id/doc/functions/backcalls.md
index e34331e..8d542ee 100644
--- a/doc/docs/id-id/doc/functions/backcalls.md
+++ b/doc/docs/id-id/doc/functions/backcalls.md
@@ -1,6 +1,6 @@
1# Backcalls 1# Backcall
2 2
3Backcalls are used for unnesting callbacks. They are defined using arrows pointed to the left as the last parameter by default filling in a function call. All the syntax is mostly the same as regular arrow functions except that it is just pointing the other way and the function body does not require indent. 3Backcall digunakan untuk meratakan callback yang bersarang. Backcall didefinisikan menggunakan panah yang mengarah ke kiri sebagai parameter terakhir secara default yang akan mengisi pemanggilan fungsi. Semua sintaks pada dasarnya sama seperti fungsi panah biasa, kecuali arahnya berlawanan dan badan fungsi tidak memerlukan indentasi.
4 4
5```yuescript 5```yuescript
6x <- f 6x <- f
@@ -15,7 +15,7 @@ print "hello" .. x
15 15
16</YueDisplay> 16</YueDisplay>
17 17
18Fat arrow functions are also available. 18Fungsi panah tebal juga tersedia.
19 19
20```yuescript 20```yuescript
21<= f 21<= f
@@ -30,7 +30,7 @@ print @value
30 30
31</YueDisplay> 31</YueDisplay>
32 32
33You can specify a placeholder for where you want the backcall function to go as a parameter. 33Anda dapat menentukan placeholder untuk posisi fungsi backcall sebagai parameter.
34 34
35```yuescript 35```yuescript
36(x) <- map _, [1, 2, 3] 36(x) <- map _, [1, 2, 3]
@@ -45,7 +45,7 @@ x * 2
45 45
46</YueDisplay> 46</YueDisplay>
47 47
48If you wish to have further code after your backcalls, you can set them aside with a do statement. And the parentheses can be omitted with non-fat arrow functions. 48Jika Anda ingin menulis kode lanjutan setelah backcall, Anda dapat memisahkannya dengan pernyataan `do`. Tanda kurung dapat dihilangkan untuk fungsi panah non-tebal.
49 49
50```yuescript 50```yuescript
51result, msg = do 51result, msg = do
diff --git a/doc/docs/id-id/doc/functions/function-literals.md b/doc/docs/id-id/doc/functions/function-literals.md
index 316e07c..589a26d 100644
--- a/doc/docs/id-id/doc/functions/function-literals.md
+++ b/doc/docs/id-id/doc/functions/function-literals.md
@@ -1,21 +1,21 @@
1# Function Literals 1# Literal Fungsi
2 2
3All functions are created using a function expression. A simple function is denoted using the arrow: **->**. 3Semua fungsi dibuat menggunakan ekspresi fungsi. Fungsi sederhana ditandai dengan panah: **->**.
4 4
5```yuescript 5```yuescript
6my_function = -> 6my_function = ->
7my_function() -- call the empty function 7my_function() -- memanggil fungsi kosong
8``` 8```
9<YueDisplay> 9<YueDisplay>
10 10
11```yue 11```yue
12my_function = -> 12my_function = ->
13my_function() -- call the empty function 13my_function() -- memanggil fungsi kosong
14``` 14```
15 15
16</YueDisplay> 16</YueDisplay>
17 17
18The body of the function can either be one statement placed directly after the arrow, or it can be a series of statements indented on the following lines: 18Badan fungsi bisa berupa satu pernyataan yang ditulis langsung setelah panah, atau berupa serangkaian pernyataan yang diindentasi di baris berikutnya:
19 19
20```yuescript 20```yuescript
21func_a = -> print "hello world" 21func_a = -> print "hello world"
@@ -36,7 +36,7 @@ func_b = ->
36 36
37</YueDisplay> 37</YueDisplay>
38 38
39If a function has no arguments, it can be called using the ! operator, instead of empty parentheses. The ! invocation is the preferred way to call functions with no arguments. 39Jika fungsi tidak memiliki argumen, ia dapat dipanggil menggunakan operator `!`, sebagai ganti tanda kurung kosong. Pemanggilan `!` adalah cara yang disarankan untuk memanggil fungsi tanpa argumen.
40 40
41```yuescript 41```yuescript
42func_a! 42func_a!
@@ -51,7 +51,7 @@ func_b()
51 51
52</YueDisplay> 52</YueDisplay>
53 53
54Functions with arguments can be created by preceding the arrow with a list of argument names in parentheses: 54Fungsi dengan argumen dapat dibuat dengan menaruh daftar nama argumen dalam tanda kurung sebelum panah:
55 55
56```yuescript 56```yuescript
57sum = (x, y) -> print "sum", x + y 57sum = (x, y) -> print "sum", x + y
@@ -64,7 +64,7 @@ sum = (x, y) -> print "sum", x + y
64 64
65</YueDisplay> 65</YueDisplay>
66 66
67Functions can be called by listing the arguments after the name of an expression that evaluates to a function. When chaining together function calls, the arguments are applied to the closest function to the left. 67Fungsi dapat dipanggil dengan menuliskan argumen setelah nama ekspresi yang mengevaluasi ke fungsi. Saat merangkai pemanggilan fungsi, argumen diterapkan ke fungsi terdekat di sebelah kiri.
68 68
69```yuescript 69```yuescript
70sum 10, 20 70sum 10, 20
@@ -83,7 +83,7 @@ a b c "a", "b", "c"
83 83
84</YueDisplay> 84</YueDisplay>
85 85
86In order to avoid ambiguity in when calling functions, parentheses can also be used to surround the arguments. This is required here in order to make sure the right arguments get sent to the right functions. 86Untuk menghindari ambiguitas saat memanggil fungsi, tanda kurung juga bisa digunakan untuk mengelilingi argumen. Ini diperlukan di sini agar argumen yang tepat dikirim ke fungsi yang tepat.
87 87
88```yuescript 88```yuescript
89print "x:", sum(10, 20), "y:", sum(30, 40) 89print "x:", sum(10, 20), "y:", sum(30, 40)
@@ -96,9 +96,9 @@ print "x:", sum(10, 20), "y:", sum(30, 40)
96 96
97</YueDisplay> 97</YueDisplay>
98 98
99There must not be any space between the opening parenthesis and the function. 99Tidak boleh ada spasi antara tanda kurung buka dan nama fungsi.
100 100
101Functions will coerce the last statement in their body into a return statement, this is called implicit return: 101Fungsi akan memaksa pernyataan terakhir di badannya menjadi pernyataan return, ini disebut return implisit:
102 102
103```yuescript 103```yuescript
104sum = (x, y) -> x + y 104sum = (x, y) -> x + y
@@ -113,7 +113,7 @@ print "The sum is ", sum 10, 20
113 113
114</YueDisplay> 114</YueDisplay>
115 115
116And if you need to explicitly return, you can use the return keyword: 116Dan jika Anda perlu return secara eksplisit, Anda bisa menggunakan kata kunci `return`:
117 117
118```yuescript 118```yuescript
119sum = (x, y) -> return x + y 119sum = (x, y) -> return x + y
@@ -126,7 +126,7 @@ sum = (x, y) -> return x + y
126 126
127</YueDisplay> 127</YueDisplay>
128 128
129Just like in Lua, functions can return multiple values. The last statement must be a list of values separated by commas: 129Seperti di Lua, fungsi dapat mengembalikan beberapa nilai. Pernyataan terakhir harus berupa daftar nilai yang dipisahkan koma:
130 130
131```yuescript 131```yuescript
132mystery = (x, y) -> x + y, x - y 132mystery = (x, y) -> x + y, x - y
@@ -141,9 +141,9 @@ a, b = mystery 10, 20
141 141
142</YueDisplay> 142</YueDisplay>
143 143
144## Fat Arrows 144## Panah Tebal
145 145
146Because it is an idiom in Lua to send an object as the first argument when calling a method, a special syntax is provided for creating functions which automatically includes a self argument. 146Karena sudah menjadi idiom di Lua untuk mengirim objek sebagai argumen pertama saat memanggil method, disediakan sintaks khusus untuk membuat fungsi yang otomatis menyertakan argumen `self`.
147 147
148```yuescript 148```yuescript
149func = (num) => @value + num 149func = (num) => @value + num
@@ -156,9 +156,9 @@ func = (num) => @value + num
156 156
157</YueDisplay> 157</YueDisplay>
158 158
159## Argument Defaults 159## Nilai Default Argumen
160 160
161It is possible to provide default values for the arguments of a function. An argument is determined to be empty if its value is nil. Any nil arguments that have a default value will be replace before the body of the function is run. 161Dimungkinkan untuk menyediakan nilai default bagi argumen fungsi. Argumen dianggap kosong jika nilainya nil. Argumen nil yang memiliki nilai default akan diganti sebelum badan fungsi dijalankan.
162 162
163```yuescript 163```yuescript
164my_function = (name = "something", height = 100) -> 164my_function = (name = "something", height = 100) ->
@@ -175,7 +175,7 @@ my_function = (name = "something", height = 100) ->
175 175
176</YueDisplay> 176</YueDisplay>
177 177
178An argument default value expression is evaluated in the body of the function in the order of the argument declarations. For this reason default values have access to previously declared arguments. 178Ekspresi nilai default argumen dievaluasi di dalam badan fungsi sesuai urutan deklarasi argumen. Karena itu, nilai default dapat mengakses argumen yang dideklarasikan sebelumnya.
179 179
180```yuescript 180```yuescript
181some_args = (x = 100, y = x + 1000) -> 181some_args = (x = 100, y = x + 1000) ->
@@ -190,11 +190,11 @@ some_args = (x = 100, y = x + 1000) ->
190 190
191</YueDisplay> 191</YueDisplay>
192 192
193## Considerations 193## Pertimbangan
194 194
195Because of the expressive parentheses-less way of calling functions, some restrictions must be put in place to avoid parsing ambiguity involving whitespace. 195Karena cara pemanggilan fungsi tanpa tanda kurung yang ekspresif, beberapa pembatasan harus diterapkan untuk menghindari ambiguitas parsing yang melibatkan spasi.
196 196
197The minus sign plays two roles, a unary negation operator and a binary subtraction operator. Consider how the following examples compile: 197Tanda minus memiliki dua peran, operator negasi unari dan operator pengurangan biner. Perhatikan bagaimana contoh berikut dikompilasi:
198 198
199```yuescript 199```yuescript
200a = x - 10 200a = x - 10
@@ -213,11 +213,11 @@ d = x- z
213 213
214</YueDisplay> 214</YueDisplay>
215 215
216The precedence of the first argument of a function call can be controlled using whitespace if the argument is a literal string. In Lua, it is common to leave off parentheses when calling a function with a single string or table literal. 216Prioritas argumen pertama pada pemanggilan fungsi dapat dikendalikan menggunakan spasi jika argumennya adalah literal string. Di Lua, sudah umum untuk menghilangkan tanda kurung saat memanggil fungsi dengan satu literal string atau tabel.
217 217
218When there is no space between a variable and a string literal, the function call takes precedence over any following expressions. No other arguments can be passed to the function when it is called this way. 218Ketika tidak ada spasi antara variabel dan literal string, pemanggilan fungsi akan memiliki prioritas atas ekspresi yang mengikuti. Tidak ada argumen lain yang dapat diberikan pada fungsi ketika dipanggil dengan cara ini.
219 219
220Where there is a space following a variable and a string literal, the function call acts as show above. The string literal belongs to any following expressions (if they exist), which serves as the argument list. 220Ketika ada spasi setelah variabel dan literal string, pemanggilan fungsi bertindak seperti yang dijelaskan di atas. Literal string menjadi milik ekspresi berikutnya (jika ada), yang berfungsi sebagai daftar argumen.
221 221
222```yuescript 222```yuescript
223x = func"hello" + 100 223x = func"hello" + 100
@@ -232,11 +232,11 @@ y = func "hello" + 100
232 232
233</YueDisplay> 233</YueDisplay>
234 234
235## Multi-line arguments 235## Argumen Multi-baris
236 236
237When calling functions that take a large number of arguments, it is convenient to split the argument list over multiple lines. Because of the white-space sensitive nature of the language, care must be taken when splitting up the argument list. 237Saat memanggil fungsi yang menerima banyak argumen, akan lebih nyaman untuk memecah daftar argumen menjadi beberapa baris. Karena sifat bahasa yang peka terhadap spasi, perlu hati-hati saat memecah daftar argumen.
238 238
239If an argument list is to be continued onto the next line, the current line must end in a comma. And the following line must be indented more than the current indentation. Once indented, all other argument lines must be at the same level of indentation to be part of the argument list 239Jika daftar argumen akan dilanjutkan ke baris berikutnya, baris saat ini harus diakhiri dengan koma. Dan baris berikutnya harus lebih terindentasi daripada indentasi saat ini. Setelah diindentasi, semua baris argumen lainnya harus berada pada tingkat indentasi yang sama agar menjadi bagian dari daftar argumen.
240 240
241```yuescript 241```yuescript
242my_func 5, 4, 3, 242my_func 5, 4, 3,
@@ -261,7 +261,7 @@ cool_func 1, 2,
261 261
262</YueDisplay> 262</YueDisplay>
263 263
264This type of invocation can be nested. The level of indentation is used to determine to which function the arguments belong to. 264Jenis pemanggilan ini dapat dinest. Tingkat indentasi digunakan untuk menentukan argumen milik fungsi yang mana.
265 265
266```yuescript 266```yuescript
267my_func 5, 6, 7, 267my_func 5, 6, 7,
@@ -280,7 +280,7 @@ my_func 5, 6, 7,
280 280
281</YueDisplay> 281</YueDisplay>
282 282
283Because tables also use the comma as a delimiter, this indentation syntax is helpful for letting values be part of the argument list instead of being part of the table. 283Karena tabel juga menggunakan koma sebagai pemisah, sintaks indentasi ini membantu agar nilai menjadi bagian dari daftar argumen, bukan bagian dari tabel.
284 284
285```yuescript 285```yuescript
286x = [ 286x = [
@@ -301,7 +301,7 @@ x = [
301 301
302</YueDisplay> 302</YueDisplay>
303 303
304Although uncommon, notice how we can give a deeper indentation for function arguments if we know we will be using a lower indentation further on. 304Meskipun jarang, perhatikan bahwa kita bisa memberikan indentasi yang lebih dalam untuk argumen fungsi jika kita tahu akan menggunakan indentasi yang lebih dangkal di bagian selanjutnya.
305 305
306```yuescript 306```yuescript
307y = [ my_func 1, 2, 3, 307y = [ my_func 1, 2, 3,
@@ -320,7 +320,7 @@ y = [ my_func 1, 2, 3,
320 320
321</YueDisplay> 321</YueDisplay>
322 322
323The same thing can be done with other block level statements like conditionals. We can use indentation level to determine what statement a value belongs to: 323Hal yang sama juga dapat dilakukan pada pernyataan tingkat blok lainnya seperti kondisional. Kita bisa menggunakan tingkat indentasi untuk menentukan nilai milik pernyataan apa:
324 324
325```yuescript 325```yuescript
326if func 1, 2, 3, 326if func 1, 2, 3,
@@ -353,13 +353,13 @@ if func 1, 2, 3,
353 353
354</YueDisplay> 354</YueDisplay>
355 355
356## Parameter Destructuring 356## Destrukturisasi Parameter
357 357
358YueScript now supports destructuring function parameters when the argument is an object. Two forms of destructuring table literals are available: 358YueScript kini mendukung destrukturisasi parameter fungsi ketika argumen berupa objek. Dua bentuk destrukturisasi literal tabel tersedia:
359 359
360* **Curly-brace wrapped literals/object parameters**, allowing optional default values when fields are missing (e.g., `{:a, :b}`, `{a: a1 = 123}`). 360* **Literal berkurung kurawal/parameter objek**, memungkinkan nilai default opsional ketika field hilang (misalnya, `{:a, :b}`, `{a: a1 = 123}`).
361 361
362* **Unwrapped simple table syntax**, starting with a sequence of key-value or shorthand bindings and continuing until another expression terminates it (e.g., `:a, b: b1, :c`). This form extracts multiple fields from the same object. 362* **Sintaks tabel sederhana tanpa pembungkus**, dimulai dengan urutan key-value atau binding singkat dan berlanjut sampai ekspresi lain menghentikannya (misalnya, `:a, b: b1, :c`). Bentuk ini mengekstrak beberapa field dari objek yang sama.
363 363
364```yuescript 364```yuescript
365f1 = (:a, :b, :c) -> 365f1 = (:a, :b, :c) ->
@@ -390,9 +390,9 @@ f2 arg1, arg2
390 390
391</YueDisplay> 391</YueDisplay>
392 392
393## Prefixed Return Expression 393## Ekspresi Return Berawalan
394 394
395When working with deeply nested function bodies, it can be tedious to maintain readability and consistency of the return value. To address this, YueScript introduces the **Prefixed Return Expression** syntax. Its form is as follows: 395Saat bekerja dengan badan fungsi yang sangat bertingkat, menjaga keterbacaan dan konsistensi nilai return bisa terasa melelahkan. Untuk mengatasinya, YueScript memperkenalkan sintaks **Ekspresi Return Berawalan**. Bentuknya sebagai berikut:
396 396
397```yuescript 397```yuescript
398findFirstEven = (list): nil -> 398findFirstEven = (list): nil ->
@@ -415,7 +415,7 @@ findFirstEven = (list): nil ->
415 415
416</YueDisplay> 416</YueDisplay>
417 417
418This is equivalent to: 418Ini setara dengan:
419 419
420```yuescript 420```yuescript
421findFirstEven = (list) -> 421findFirstEven = (list) ->
@@ -440,11 +440,11 @@ findFirstEven = (list) ->
440 440
441</YueDisplay> 441</YueDisplay>
442 442
443The only difference is that you can move the final return expression before the `->` or `=>` token to indicate the function’s implicit return value as the last statement. This way, even in functions with multiple nested loops or conditional branches, you no longer need to write a trailing return expression at the end of the function body, making the logic structure more straightforward and easier to follow. 443Satu-satunya perbedaan adalah Anda dapat memindahkan ekspresi return terakhir sebelum token `->` atau `=>` untuk menunjukkan nilai return implisit fungsi sebagai pernyataan terakhir. Dengan cara ini, bahkan pada fungsi dengan banyak loop bertingkat atau cabang kondisional, Anda tidak lagi perlu menulis ekspresi return di akhir badan fungsi, sehingga struktur logika menjadi lebih lurus dan mudah diikuti.
444 444
445## Named Varargs 445## Varargs Bernama
446 446
447You can use the `(...t) ->` syntax to automatically store varargs into a named table. This table will contain all passed arguments (including `nil` values), and the `n` field of the table will store the actual number of arguments passed (including `nil` values). 447Anda dapat menggunakan sintaks `(...t) ->` untuk otomatis menyimpan varargs ke tabel bernama. Tabel ini berisi semua argumen yang diteruskan (termasuk nilai `nil`), dan field `n` pada tabel menyimpan jumlah argumen yang benar-benar diteruskan (termasuk nilai `nil`).
448 448
449```yuescript 449```yuescript
450f = (...t) -> 450f = (...t) ->
@@ -457,7 +457,7 @@ f 1, 2, 3
457f "a", "b", "c", "d" 457f "a", "b", "c", "d"
458f! 458f!
459 459
460-- Handling cases with nil values 460-- Menangani kasus dengan nilai nil
461process = (...args) -> 461process = (...args) ->
462 sum = 0 462 sum = 0
463 for i = 1, args.n 463 for i = 1, args.n
@@ -480,7 +480,7 @@ f 1, 2, 3
480f "a", "b", "c", "d" 480f "a", "b", "c", "d"
481f! 481f!
482 482
483-- Handling cases with nil values 483-- Menangani kasus dengan nilai nil
484process = (...args) -> 484process = (...args) ->
485 sum = 0 485 sum = 0
486 for i = 1, args.n 486 for i = 1, args.n
diff --git a/doc/docs/id-id/doc/functions/function-stubs.md b/doc/docs/id-id/doc/functions/function-stubs.md
index 57a8b0c..57ed5c1 100644
--- a/doc/docs/id-id/doc/functions/function-stubs.md
+++ b/doc/docs/id-id/doc/functions/function-stubs.md
@@ -1,10 +1,10 @@
1# Function Stubs 1# Stub Fungsi
2 2
3It is common to pass a function from an object around as a value, for example, passing an instance method into a function as a callback. If the function expects the object it is operating on as the first argument then you must somehow bundle that object with the function so it can be called properly. 3Sering kali fungsi dari sebuah objek diteruskan sebagai nilai, misalnya meneruskan method instance ke fungsi lain sebagai callback. Jika fungsi mengharapkan objek yang dioperasikan sebagai argumen pertama, maka Anda harus menggabungkan objek tersebut dengan fungsi agar dapat dipanggil dengan benar.
4 4
5The function stub syntax is a shorthand for creating a new closure function that bundles both the object and function. This new function calls the wrapped function in the correct context of the object. 5Sintaks stub fungsi adalah singkatan untuk membuat fungsi closure baru yang menggabungkan objek dan fungsi. Fungsi baru ini memanggil fungsi yang dibungkus dalam konteks objek yang benar.
6 6
7Its syntax is the same as calling an instance method with the \ operator but with no argument list provided. 7Sintaksnya sama seperti memanggil method instance dengan operator `\`, tetapi tanpa menyediakan daftar argumen.
8 8
9```yuescript 9```yuescript
10my_object = { 10my_object = {
@@ -16,12 +16,12 @@ run_callback = (func) ->
16 print "running callback..." 16 print "running callback..."
17 func! 17 func!
18 18
19-- this will not work: 19-- ini tidak akan berfungsi:
20-- the function has to no reference to my_object 20-- fungsi tidak memiliki referensi ke my_object
21run_callback my_object.write 21run_callback my_object.write
22 22
23-- function stub syntax 23-- sintaks stub fungsi
24-- lets us bundle the object into a new function 24-- memungkinkan kita membundel objek ke fungsi baru
25run_callback my_object\write 25run_callback my_object\write
26``` 26```
27<YueDisplay> 27<YueDisplay>
@@ -36,12 +36,12 @@ run_callback = (func) ->
36 print "running callback..." 36 print "running callback..."
37 func! 37 func!
38 38
39-- this will not work: 39-- ini tidak akan berfungsi:
40-- the function has to no reference to my_object 40-- fungsi tidak memiliki referensi ke my_object
41run_callback my_object.write 41run_callback my_object.write
42 42
43-- function stub syntax 43-- sintaks stub fungsi
44-- lets us bundle the object into a new function 44-- memungkinkan kita membundel objek ke fungsi baru
45run_callback my_object\write 45run_callback my_object\write
46``` 46```
47 47
diff --git a/doc/docs/id-id/doc/getting-started/installation.md b/doc/docs/id-id/doc/getting-started/installation.md
index a93ddfd..2809cca 100644
--- a/doc/docs/id-id/doc/getting-started/installation.md
+++ b/doc/docs/id-id/doc/getting-started/installation.md
@@ -1,43 +1,43 @@
1# Installation 1# Instalasi
2 2
3## Lua Module 3## Modul Lua
4 4
5Install [luarocks](https://luarocks.org), a package manager for Lua modules. Then install it as a Lua module and executable with: 5Instal [luarocks](https://luarocks.org), manajer paket untuk modul Lua. Lalu instal sebagai modul Lua dan executable dengan:
6 6
7```shell 7```shell
8luarocks install yuescript 8luarocks install yuescript
9``` 9```
10 10
11Or you can build `yue.so` file with: 11Atau Anda dapat membangun file `yue.so` dengan:
12 12
13```shell 13```shell
14make shared LUAI=/usr/local/include/lua LUAL=/usr/local/lib/lua 14make shared LUAI=/usr/local/include/lua LUAL=/usr/local/lib/lua
15``` 15```
16 16
17Then get the binary file from path **bin/shared/yue.so**. 17Lalu ambil file biner dari path **bin/shared/yue.so**.
18 18
19## Build Binary Tool 19## Membangun Tool Biner
20 20
21Clone this repo, then build and install executable with: 21Klon repo ini, lalu bangun dan instal executable dengan:
22 22
23```shell 23```shell
24make install 24make install
25``` 25```
26 26
27Build YueScript tool without macro feature: 27Bangun tool YueScript tanpa fitur macro:
28 28
29```shell 29```shell
30make install NO_MACRO=true 30make install NO_MACRO=true
31``` 31```
32 32
33Build YueScript tool without built-in Lua binary: 33Bangun tool YueScript tanpa biner Lua bawaan:
34 34
35```shell 35```shell
36make install NO_LUA=true 36make install NO_LUA=true
37``` 37```
38 38
39## Download Precompiled Binary 39## Unduh Biner Pra-kompilasi
40 40
41You can download precompiled binary files, including binary executable files compatible with different Lua versions and library files. 41Anda dapat mengunduh file biner pra-kompilasi, termasuk file executable biner yang kompatibel dengan berbagai versi Lua dan file library.
42 42
43Download precompiled binary files from [here](https://github.com/IppClub/YueScript/releases). 43Unduh file biner pra-kompilasi dari [sini](https://github.com/IppClub/YueScript/releases).
diff --git a/doc/docs/id-id/doc/getting-started/introduction.md b/doc/docs/id-id/doc/getting-started/introduction.md
index a9a9389..c2fc236 100644
--- a/doc/docs/id-id/doc/getting-started/introduction.md
+++ b/doc/docs/id-id/doc/getting-started/introduction.md
@@ -1,10 +1,10 @@
1# Introduction 1# Pendahuluan
2 2
3YueScript is a dynamic language that compiles to Lua. And it's a [MoonScript](https://github.com/leafo/moonscript) dialect. The codes written in YueScript are expressive and extremely concise. And it is suitable for writing some changing application logic with more maintainable codes and runs in a Lua embeded environment such as games or website servers. 3YueScript adalah bahasa dinamis yang dikompilasi ke Lua, dan merupakan dialek [MoonScript](https://github.com/leafo/moonscript). Kode yang ditulis dengan YueScript ekspresif dan sangat ringkas. YueScript cocok untuk menulis logika aplikasi yang sering berubah dengan kode yang lebih mudah dipelihara, serta berjalan di lingkungan embed Lua seperti game atau server situs web.
4 4
5Yue (月) is the name of moon in Chinese and it's pronounced as [jyɛ]. 5Yue (月) adalah kata untuk bulan dalam bahasa Tionghoa dan diucapkan sebagai [jyɛ].
6 6
7## An Overview of YueScript 7## Ikhtisar YueScript
8 8
9```yuescript 9```yuescript
10-- import syntax 10-- import syntax
@@ -48,7 +48,7 @@ with apple
48 p .size, .color, .<index> if .<>? 48 p .size, .color, .<index> if .<>?
49 49
50-- js-like export syntax 50-- js-like export syntax
51export 🌛 = "月之脚本" 51export 🌛 = "Skrip Bulan"
52``` 52```
53 53
54<YueDisplay> 54<YueDisplay>
@@ -95,11 +95,11 @@ with apple
95 p .size, .color, .<index> if .<>? 95 p .size, .color, .<index> if .<>?
96 96
97-- js-like export syntax 97-- js-like export syntax
98export 🌛 = "月之脚本" 98export 🌛 = "Skrip Bulan"
99``` 99```
100 100
101</YueDisplay> 101</YueDisplay>
102 102
103## About Dora SSR 103## Tentang Dora SSR
104 104
105YueScript is being developed and maintained alongside the open-source game engine [Dora SSR](https://github.com/Dora-SSR/Dora-SSR). It has been used to create engine tools, game demos and prototypes, validating its capabilities in real-world scenarios while enhancing the Dora SSR development experience. \ No newline at end of file 105YueScript dikembangkan dan dipelihara bersama mesin game open-source [Dora SSR](https://github.com/Dora-SSR/Dora-SSR). YueScript telah digunakan untuk membuat alat mesin, demo game, dan prototipe, membuktikan kemampuannya dalam skenario dunia nyata sekaligus meningkatkan pengalaman pengembangan Dora SSR.
diff --git a/doc/docs/id-id/doc/getting-started/usage.md b/doc/docs/id-id/doc/getting-started/usage.md
index 45161c6..85cad07 100644
--- a/doc/docs/id-id/doc/getting-started/usage.md
+++ b/doc/docs/id-id/doc/getting-started/usage.md
@@ -1,20 +1,20 @@
1# Usage 1# Penggunaan
2 2
3## Lua Module 3## Modul Lua
4 4
5Use YueScript module in Lua: 5Gunakan modul YueScript di Lua:
6 6
7* **Case 1** 7* **Kasus 1**
8 8
9 Require "your_yuescript_entry.yue" in Lua. 9 Require "your_yuescript_entry.yue" di Lua.
10 ```Lua 10 ```Lua
11 require("yue")("your_yuescript_entry") 11 require("yue")("your_yuescript_entry")
12 ``` 12 ```
13 And this code still works when you compile "your_yuescript_entry.yue" to "your_yuescript_entry.lua" in the same path. In the rest YueScript files just use the normal **require** or **import**. The code line numbers in error messages will also be handled correctly. 13 Dan kode ini tetap bekerja ketika Anda mengompilasi "your_yuescript_entry.yue" menjadi "your_yuescript_entry.lua" di path yang sama. Pada file YueScript lainnya cukup gunakan **require** atau **import** biasa. Nomor baris pada pesan error juga akan ditangani dengan benar.
14 14
15* **Case 2** 15* **Kasus 2**
16 16
17 Require YueScript module and rewite message by hand. 17 Require modul YueScript dan tulis ulang pesan secara manual.
18 18
19 ```lua 19 ```lua
20 local yue = require("yue") 20 local yue = require("yue")
@@ -26,9 +26,9 @@ Use YueScript module in Lua:
26 end) 26 end)
27 ``` 27 ```
28 28
29* **Case 3** 29* **Kasus 3**
30 30
31 Use the YueScript compiler function in Lua. 31 Gunakan fungsi kompiler YueScript di Lua.
32 32
33 ```lua 33 ```lua
34 local yue = require("yue") 34 local yue = require("yue")
@@ -48,64 +48,65 @@ Use YueScript module in Lua:
48 }) 48 })
49 ``` 49 ```
50 50
51## YueScript Tool 51## Tool YueScript
52 52
53Use YueScript tool with: 53Gunakan tool YueScript dengan:
54 54
55```shell 55```shell
56> yue -h 56> yue -h
57Usage: yue 57Penggunaan: yue
58 [options] [<file/directory>] ... 58 [opsi] [<file/direktori>] ...
59 yue -e <code_or_file> [args...] 59 yue -e <kode_atau_file> [argumen...]
60 yue -w [<directory>] [options] 60 yue -w [<direktori>] [opsi]
61 yue - 61 yue -
62 62
63Notes: 63Catatan:
64 - '-' / '--' must be the first and only argument. 64 - '-' / '--' harus menjadi argumen pertama dan satu-satunya.
65 - '-o/--output' can not be used with multiple input files. 65 - '-o/--output' tidak dapat digunakan dengan beberapa file input.
66 - '-w/--watch' can not be used with file input (directory only). 66 - '-w/--watch' tidak dapat digunakan dengan file input (khusus direktori).
67 - with '-e/--execute', remaining tokens are treated as script args. 67 - dengan '-e/--execute', token sisanya dianggap sebagai argumen skrip.
68 68
69Options: 69Opsi:
70 -h, --help Show this help message and exit. 70 -h, --help Tampilkan pesan bantuan ini dan keluar.
71 -e <str>, --execute <str> Execute a file or raw codes 71 -e <str>, --execute <str> Eksekusi file atau kode mentah
72 -m, --minify Generate minified codes 72 -m, --minify Menghasilkan kode yang sudah diminimasi
73 -r, --rewrite Rewrite output to match original line numbers 73 -r, --rewrite Tulis ulang output agar sesuai dengan nomor baris asal
74 -t <output_to>, --output-to <output_to> 74 -t <output_to>, --output-to <output_to>
75 Specify where to place compiled files 75 Tentukan lokasi untuk menaruh file hasil kompilasi
76 -o <file>, --output <file> Write output to file 76 -o <file>, --output <file> Tulis output ke file
77 -p, --print Write output to standard out 77 -p, --print Tulis output ke standar output
78 -b, --benchmark Dump compile time (doesn't write output) 78 -b, --benchmark Tampilkan waktu kompilasi (tanpa menulis output)
79 -g, --globals Dump global variables used in NAME LINE COLUMN 79 -g, --globals Tampilkan variabel global yang digunakan dalam FORMAT NAMA BARIS KOLOM
80 -s, --spaces Use spaces in generated codes instead of tabs 80 -s, --spaces Pakai spasi di kode hasil kompilasi (bukan tab)
81 -l, --line-numbers Write line numbers from source codes 81 -l, --line-numbers Tulis nomor baris dari kode sumber
82 -j, --no-implicit-return Disable implicit return at end of file 82 -j, --no-implicit-return Nonaktifkan return implisit di akhir file
83 -c, --reserve-comments Reserve comments before statement from source codes 83 -c, --reserve-comments Pertahankan komentar sebelum pernyataan dari kode sumber
84 -w [<dir>], --watch [<dir>] 84 -w [<dir>], --watch [<dir>]
85 Watch changes and compile every file under directory 85 Pantau perubahan dan kompilasi setiap file di bawah direktori
86 -v, --version Print version 86 -v, --version Tampilkan versi
87 - Read from standard in, print to standard out 87 - Baca dari standar input, tulis ke standar output
88 (Must be first and only argument) 88 (harus menjadi argumen pertama dan satu-satunya)
89 -- Same as '-' (kept for backward compatibility) 89 -- Sama dengan '-', dipertahankan untuk kompatibilitas lama
90 90
91 --target <version> Specify the Lua version that codes will be generated to 91 --target <versi> Tentukan versi Lua yang akan dihasilkan kodenya
92 (version can only be 5.1 to 5.5) 92 (versi hanya bisa dari 5.1 sampai 5.5)
93 --path <path_str> Append an extra Lua search path string to package.path 93 --path <path_str> Tambahkan path pencarian Lua tambahan ke package.path
94 --<key>=<value> Pass compiler option in key=value form (existing behavior) 94 --<key>=<value> Kirim opsi kompilasi dalam bentuk key=value (perilaku standar)
95 95
96 Execute without options to enter REPL, type symbol '$' 96 Jalankan tanpa opsi untuk masuk ke REPL, ketik simbol '$'
97 in a single line to start/stop multi-line mode 97 dalam satu baris untuk memulai/mengakhiri mode multi-baris
98``` 98```
99Use cases:
100 99
101Recursively compile every YueScript file with extension **.yue** under current path: **yue .** 100Gunakan kasus:
102 101
103Compile and save results to a target path: **yue -t /target/path/ .** 102Kompilasi semua file YueScript dengan ekstensi **.yue** secara rekursif di bawah path saat ini: **yue .**
104 103
105Compile and reserve debug info: **yue -l .** 104Kompilasi dan simpan hasil ke path target: **yue -t /target/path/ .**
106 105
107Compile and generate minified codes: **yue -m .** 106Kompilasi dan pertahankan info debug: **yue -l .**
108 107
109Execute raw codes: **yue -e 'print 123'** 108Kompilasi dan hasilkan kode yang diminisasi: **yue -m .**
110 109
111Execute a YueScript file: **yue -e main.yue** 110Eksekusi kode mentah: **yue -e 'print 123'**
111
112Eksekusi file YueScript: **yue -e main.yue**
diff --git a/doc/docs/id-id/doc/index.md b/doc/docs/id-id/doc/index.md
index b7f609b..5df2cc3 100755
--- a/doc/docs/id-id/doc/index.md
+++ b/doc/docs/id-id/doc/index.md
@@ -1,11 +1,11 @@
1--- 1---
2title: Reference 2title: Referensi
3--- 3---
4 4
5# YueScript Documentation 5# Dokumentasi YueScript
6 6
7<img src="/image/yuescript.svg" width="250px" height="250px" alt="logo" style="padding-top: 3em; padding-bottom: 2em;"/> 7<img src="/image/yuescript.svg" width="250px" height="250px" alt="logo" style="padding-top: 3em; padding-bottom: 2em;"/>
8 8
9Welcome to the <b>YueScript</b> official documentation!<br/> 9Selamat datang di dokumentasi resmi <b>YueScript</b>!<br/>
10Here you can find the language features, usage, reference examples and resources.<br/> 10Di sini Anda dapat menemukan fitur bahasa, penggunaan, contoh referensi, dan sumber daya.<br/>
11Please select a chapter from the sidebar to start learning about YueScript. 11Silakan pilih bab dari sidebar untuk mulai mempelajari YueScript.
diff --git a/doc/docs/id-id/doc/language-basics/attributes.md b/doc/docs/id-id/doc/language-basics/attributes.md
index e6fd5a7..5b92947 100644
--- a/doc/docs/id-id/doc/language-basics/attributes.md
+++ b/doc/docs/id-id/doc/language-basics/attributes.md
@@ -1,6 +1,6 @@
1# Attributes 1# Atribut
2 2
3Syntax support for Lua 5.4 attributes. And you can still use both the `const` and `close` declaration and get constant check and scoped callback working when targeting Lua versions below 5.4. 3Dukungan sintaks untuk atribut Lua 5.4. Anda juga masih bisa menggunakan deklarasi `const` dan `close` dan mendapatkan pemeriksaan konstanta serta callback berbatas-scope ketika menargetkan versi Lua di bawah 5.4.
4 4
5```yuescript 5```yuescript
6const a = 123 6const a = 123
@@ -15,7 +15,7 @@ close _ = <close>: -> print "Out of scope."
15 15
16</YueDisplay> 16</YueDisplay>
17 17
18You can do desctructuring with variables attributed as constant. 18Anda dapat melakukan destrukturisasi dengan variabel yang diberi atribut sebagai konstanta.
19 19
20```yuescript 20```yuescript
21const {:a, :b, c, d} = tb 21const {:a, :b, c, d} = tb
@@ -30,7 +30,7 @@ const {:a, :b, c, d} = tb
30 30
31</YueDisplay> 31</YueDisplay>
32 32
33You can also declare a global variable to be `const`. 33Anda juga bisa mendeklarasikan variabel global sebagai `const`.
34 34
35```yuescript 35```yuescript
36global const Constant = 123 36global const Constant = 123
diff --git a/doc/docs/id-id/doc/language-basics/comment.md b/doc/docs/id-id/doc/language-basics/comment.md
index b67c97d..99f7b51 100644
--- a/doc/docs/id-id/doc/language-basics/comment.md
+++ b/doc/docs/id-id/doc/language-basics/comment.md
@@ -1,13 +1,13 @@
1# Comment 1# Komentar
2 2
3```yuescript 3```yuescript
4-- I am a comment 4-- Saya adalah komentar
5 5
6str = --[[ 6str = --[[
7This is a multi-line comment. 7Ini komentar multi-baris.
8It's OK. 8Tidak masalah.
9]] strA \ -- comment 1 9]] strA \ -- komentar 1
10 .. strB \ -- comment 2 10 .. strB \ -- komentar 2
11 .. strC 11 .. strC
12 12
13func --[[port]] 3000, --[[ip]] "192.168.1.1" 13func --[[port]] 3000, --[[ip]] "192.168.1.1"
@@ -15,13 +15,13 @@ func --[[port]] 3000, --[[ip]] "192.168.1.1"
15<YueDisplay> 15<YueDisplay>
16 16
17```yue 17```yue
18-- I am a comment 18-- Saya adalah komentar
19 19
20str = --[[ 20str = --[[
21This is a multi-line comment. 21Ini komentar multi-baris.
22It's OK. 22Tidak masalah.
23]] strA \ -- comment 1 23]] strA \ -- komentar 1
24 .. strB \ -- comment 2 24 .. strB \ -- komentar 2
25 .. strC 25 .. strC
26 26
27func --[[port]] 3000, --[[ip]] "192.168.1.1" 27func --[[port]] 3000, --[[ip]] "192.168.1.1"
diff --git a/doc/docs/id-id/doc/language-basics/literals.md b/doc/docs/id-id/doc/language-basics/literals.md
index e097c62..c17c310 100644
--- a/doc/docs/id-id/doc/language-basics/literals.md
+++ b/doc/docs/id-id/doc/language-basics/literals.md
@@ -1,15 +1,15 @@
1# Literals 1# Literal
2 2
3All of the primitive literals in Lua can be used. This applies to numbers, strings, booleans, and **nil**. 3Semua literal primitif di Lua dapat digunakan. Ini berlaku untuk angka, string, boolean, dan **nil**.
4 4
5Unlike Lua, Line breaks are allowed inside of single and double quote strings without an escape sequence: 5Berbeda dengan Lua, pemisah baris diizinkan di dalam string bertanda kutip tunggal maupun ganda tanpa urutan escape:
6 6
7```yuescript 7```yuescript
8some_string = "Here is a string 8some_string = "Here is a string
9 that has a line break in it." 9 that has a line break in it."
10 10
11-- You can mix expressions into string literals using #{} syntax. 11-- Anda dapat mencampur ekspresi ke dalam literal string dengan sintaks #{}.
12-- String interpolation is only available in double quoted strings. 12-- Interpolasi string hanya tersedia pada string dengan tanda kutip ganda.
13print "I am #{math.random! * 100}% sure." 13print "I am #{math.random! * 100}% sure."
14``` 14```
15<YueDisplay> 15<YueDisplay>
@@ -18,16 +18,16 @@ print "I am #{math.random! * 100}% sure."
18some_string = "Here is a string 18some_string = "Here is a string
19 that has a line break in it." 19 that has a line break in it."
20 20
21-- You can mix expressions into string literals using #{} syntax. 21-- Anda dapat mencampur ekspresi ke dalam literal string dengan sintaks #{}.
22-- String interpolation is only available in double quoted strings. 22-- Interpolasi string hanya tersedia pada string dengan tanda kutip ganda.
23print "I am #{math.random! * 100}% sure." 23print "I am #{math.random! * 100}% sure."
24``` 24```
25 25
26</YueDisplay> 26</YueDisplay>
27 27
28## Number Literals 28## Literal Angka
29 29
30You can use underscores in a number literal to increase readability. 30Anda bisa menggunakan garis bawah pada literal angka untuk meningkatkan keterbacaan.
31 31
32```yuescript 32```yuescript
33integer = 1_000_000 33integer = 1_000_000
@@ -44,9 +44,9 @@ binary = 0B10011
44 44
45</YueDisplay> 45</YueDisplay>
46 46
47## YAML Multiline String 47## String Multibaris YAML
48 48
49The `|` prefix introduces a YAML-style multiline string literal: 49Prefiks `|` memperkenalkan literal string multibaris bergaya YAML:
50 50
51```yuescript 51```yuescript
52str = | 52str = |
@@ -67,9 +67,9 @@ str = |
67 67
68</YueDisplay> 68</YueDisplay>
69 69
70This allows writing structured multiline text conveniently. All line breaks and indentation are preserved relative to the first non-empty line, and expressions inside `#{...}` are interpolated automatically as `tostring(expr)`. 70Ini memungkinkan penulisan teks multibaris terstruktur dengan mudah. Semua pemisah baris dan indentasi dipertahankan relatif terhadap baris non-kosong pertama, dan ekspresi di dalam `#{...}` diinterpolasi otomatis sebagai `tostring(expr)`.
71 71
72YAML Multiline String automatically detects the common leading whitespace prefix (minimum indentation across all non-empty lines) and removes it from all lines. This makes it easy to indent your code visually without affecting the resulting string content. 72String Multibaris YAML secara otomatis mendeteksi prefiks spasi awal yang sama (indentasi minimum di seluruh baris non-kosong) dan menghapusnya dari semua baris. Ini memudahkan untuk mengindentasi kode secara visual tanpa memengaruhi isi string yang dihasilkan.
73 73
74```yuescript 74```yuescript
75fn = -> 75fn = ->
@@ -90,9 +90,9 @@ fn = ->
90 90
91</YueDisplay> 91</YueDisplay>
92 92
93Internal indentation is preserved relative to the removed common prefix, allowing clean nested structures. 93Indentasi internal dipertahankan relatif terhadap prefiks umum yang dihapus, sehingga struktur bertingkat tetap rapi.
94 94
95All special characters like quotes (`"`) and backslashes (`\`) in the YAMLMultiline block are automatically escaped so that the generated Lua string is syntactically valid and behaves as expected. 95Semua karakter khusus seperti tanda kutip (`"`) dan backslash (`\`) di dalam blok YAMLMultiline di-escape secara otomatis agar string Lua yang dihasilkan valid secara sintaks dan berperilaku sebagaimana mestinya.
96 96
97```yuescript 97```yuescript
98str = | 98str = |
diff --git a/doc/docs/id-id/doc/language-basics/operator.md b/doc/docs/id-id/doc/language-basics/operator.md
index 9a2e89b..f3fe092 100644
--- a/doc/docs/id-id/doc/language-basics/operator.md
+++ b/doc/docs/id-id/doc/language-basics/operator.md
@@ -1,6 +1,6 @@
1# Operator 1# Operator
2 2
3All of Lua's binary and unary operators are available. Additionally **!=** is as an alias for **~=**, and either **\\** or **::** can be used to write a chaining function call like `tb\func!` or `tb::func!`. And Yuescipt offers some other special operators to write more expressive codes. 3Semua operator biner dan unari Lua tersedia. Selain itu **!=** adalah alias untuk **~=**, dan **\\** atau **::** bisa digunakan untuk menulis pemanggilan fungsi berantai seperti `tb\func!` atau `tb::func!`. YueScript juga menawarkan beberapa operator khusus lain untuk menulis kode yang lebih ekspresif.
4 4
5```yuescript 5```yuescript
6tb\func! if tb ~= nil 6tb\func! if tb ~= nil
@@ -15,9 +15,9 @@ tb::func! if tb != nil
15 15
16</YueDisplay> 16</YueDisplay>
17 17
18## Chaining Comparisons 18## Perbandingan Berantai
19 19
20Comparisons can be arbitrarily chained: 20Perbandingan bisa dirantai secara bebas:
21 21
22```yuescript 22```yuescript
23print 1 < 2 <= 2 < 3 == 3 > 2 >= 1 == 1 < 3 != 5 23print 1 < 2 <= 2 < 3 == 3 > 2 >= 1 == 1 < 3 != 5
@@ -40,7 +40,7 @@ print 1 <= a <= 10
40 40
41</YueDisplay> 41</YueDisplay>
42 42
43Note the evaluation behavior of chained comparisons: 43Perhatikan perilaku evaluasi perbandingan berantai:
44 44
45```yuescript 45```yuescript
46v = (x) -> 46v = (x) ->
@@ -91,11 +91,11 @@ print v(1) > v(2) <= v(3)
91 91
92</YueDisplay> 92</YueDisplay>
93 93
94The middle expression is only evaluated once, rather than twice as it would be if the expression were written as `v(1) < v(2) and v(2) <= v(3)`. However, the order of evaluations in a chained comparison is undefined. It is strongly recommended not to use expressions with side effects (such as printing) in chained comparisons. If side effects are required, the short-circuit `and` operator should be used explicitly. 94Ekspresi tengah hanya dievaluasi sekali, bukan dua kali seperti jika ekspresi ditulis sebagai `v(1) < v(2) and v(2) <= v(3)`. Namun, urutan evaluasi pada perbandingan berantai tidak didefinisikan. Sangat disarankan untuk tidak menggunakan ekspresi dengan efek samping (seperti `print`) di perbandingan berantai. Jika efek samping diperlukan, operator short-circuit `and` sebaiknya digunakan secara eksplisit.
95 95
96## Table Appending 96## Menambahkan ke Tabel
97 97
98The **[] =** operator is used to append values to tables. 98Operator **[] =** digunakan untuk menambahkan nilai ke tabel.
99 99
100```yuescript 100```yuescript
101tab = [] 101tab = []
@@ -110,13 +110,13 @@ tab[] = "Value"
110 110
111</YueDisplay> 111</YueDisplay>
112 112
113You can also use the spread operator `...` to append all elements from one list to another: 113Anda juga bisa memakai operator spread `...` untuk menambahkan semua elemen dari satu list ke list lain:
114 114
115```yuescript 115```yuescript
116tbA = [1, 2, 3] 116tbA = [1, 2, 3]
117tbB = [4, 5, 6] 117tbB = [4, 5, 6]
118tbA[] = ...tbB 118tbA[] = ...tbB
119-- tbA is now [1, 2, 3, 4, 5, 6] 119-- tbA sekarang [1, 2, 3, 4, 5, 6]
120``` 120```
121<YueDisplay> 121<YueDisplay>
122 122
@@ -124,14 +124,14 @@ tbA[] = ...tbB
124tbA = [1, 2, 3] 124tbA = [1, 2, 3]
125tbB = [4, 5, 6] 125tbB = [4, 5, 6]
126tbA[] = ...tbB 126tbA[] = ...tbB
127-- tbA is now [1, 2, 3, 4, 5, 6] 127-- tbA sekarang [1, 2, 3, 4, 5, 6]
128``` 128```
129 129
130</YueDisplay> 130</YueDisplay>
131 131
132## Table Spreading 132## Penyebaran Tabel
133 133
134You can concatenate array tables or hash tables using spread operator `...` before expressions in table literals. 134Anda bisa menggabungkan tabel array atau tabel hash menggunakan operator spread `...` sebelum ekspresi di literal tabel.
135 135
136```yuescript 136```yuescript
137parts = 137parts =
@@ -170,9 +170,9 @@ merge = {...a, ...b}
170 170
171</YueDisplay> 171</YueDisplay>
172 172
173## Table Reversed Indexing 173## Indeks Balik Tabel
174 174
175You can use the **#** operator to get the last elements of a table. 175Anda dapat menggunakan operator **#** untuk mendapatkan elemen terakhir dari tabel.
176 176
177```yuescript 177```yuescript
178last = data.items[#] 178last = data.items[#]
@@ -191,11 +191,11 @@ data.items[#] = 1
191 191
192## Metatable 192## Metatable
193 193
194The **<>** operator can be used as a shortcut for metatable manipulation. 194Operator **<>** dapat digunakan sebagai pintasan untuk manipulasi metatable.
195 195
196### Metatable Creation 196### Pembuatan Metatable
197 197
198Create normal table with empty bracekets **<>** or metamethod key which is surrounded by **<>**. 198Buat tabel normal dengan tanda kurung siku kosong **<>** atau kunci metamethod yang dikelilingi oleh **<>**.
199 199
200```yuescript 200```yuescript
201mt = {} 201mt = {}
@@ -203,7 +203,7 @@ add = (right) => <>: mt, value: @value + right.value
203mt.__add = add 203mt.__add = add
204 204
205a = <>: mt, value: 1 205a = <>: mt, value: 1
206 -- set field with variable of the same name 206 -- set field dengan variabel bernama sama
207b = :<add>, value: 2 207b = :<add>, value: 2
208c = <add>: mt.__add, value: 3 208c = <add>: mt.__add, value: 3
209 209
@@ -220,7 +220,7 @@ add = (right) => <>: mt, value: @value + right.value
220mt.__add = add 220mt.__add = add
221 221
222a = <>: mt, value: 1 222a = <>: mt, value: 1
223 -- set field with variable of the same name 223 -- set field dengan variabel bernama sama
224b = :<add>, value: 2 224b = :<add>, value: 2
225c = <add>: mt.__add, value: 3 225c = <add>: mt.__add, value: 3
226 226
@@ -232,12 +232,12 @@ close _ = <close>: -> print "out of scope"
232 232
233</YueDisplay> 233</YueDisplay>
234 234
235### Metatable Accessing 235### Mengakses Metatable
236 236
237Accessing metatable with **<>** or metamethod name surrounded by **<>** or writing some expression in **<>**. 237Akses metatable dengan **<>**, nama metamethod yang dikelilingi **<>**, atau menulis ekspresi di dalam **<>**.
238 238
239```yuescript 239```yuescript
240-- create with metatable containing field "value" 240-- dibuat dengan metatable yang berisi field "value"
241tb = <"value">: 123 241tb = <"value">: 123
242tb.<index> = tb.<> 242tb.<index> = tb.<>
243print tb.value 243print tb.value
@@ -248,7 +248,7 @@ print tb.item
248<YueDisplay> 248<YueDisplay>
249 249
250```yue 250```yue
251-- create with metatable containing field "value" 251-- dibuat dengan metatable yang berisi field "value"
252tb = <"value">: 123 252tb = <"value">: 123
253tb.<index> = tb.<> 253tb.<index> = tb.<>
254print tb.value 254print tb.value
@@ -258,9 +258,9 @@ print tb.item
258 258
259</YueDisplay> 259</YueDisplay>
260 260
261### Metatable Destructure 261### Destrukturisasi Metatable
262 262
263Destruct metatable with metamethod key surrounded by **<>**. 263Destrukturisasi metatable dengan kunci metamethod yang dikelilingi **<>**.
264 264
265```yuescript 265```yuescript
266{item, :new, :<close>, <index>: getter} = tb 266{item, :new, :<close>, <index>: getter} = tb
@@ -275,9 +275,9 @@ print item, new, close, getter
275 275
276</YueDisplay> 276</YueDisplay>
277 277
278## Existence 278## Keberadaan
279 279
280The **?** operator can be used in a variety of contexts to check for existence. 280Operator **?** dapat digunakan dalam berbagai konteks untuk memeriksa keberadaan.
281 281
282```yuescript 282```yuescript
283func?! 283func?!
@@ -314,14 +314,14 @@ with? io.open "test.txt", "w"
314 314
315## Piping 315## Piping
316 316
317Instead of a series of nested function calls, you can pipe values with operator **|>**. 317Sebagai ganti serangkaian pemanggilan fungsi bersarang, Anda bisa mengalirkan nilai dengan operator **|>**.
318 318
319```yuescript 319```yuescript
320"hello" |> print 320"hello" |> print
3211 |> print 2 -- insert pipe item as the first argument 3211 |> print 2 -- sisipkan nilai pipe sebagai argumen pertama
3222 |> print 1, _, 3 -- pipe with a placeholder 3222 |> print 1, _, 3 -- pipe dengan placeholder
323 323
324-- pipe expression in multiline 324-- ekspresi pipe multi-baris
325readFile "example.txt" 325readFile "example.txt"
326 |> extract language, {} 326 |> extract language, {}
327 |> parse language 327 |> parse language
@@ -333,9 +333,9 @@ readFile "example.txt"
333 333
334```yue 334```yue
335"hello" |> print 335"hello" |> print
3361 |> print 2 -- insert pipe item as the first argument 3361 |> print 2 -- sisipkan nilai pipe sebagai argumen pertama
3372 |> print 1, _, 3 -- pipe with a placeholder 3372 |> print 1, _, 3 -- pipe dengan placeholder
338-- pipe expression in multiline 338-- ekspresi pipe multi-baris
339readFile "example.txt" 339readFile "example.txt"
340 |> extract language, {} 340 |> extract language, {}
341 |> parse language 341 |> parse language
@@ -348,7 +348,7 @@ readFile "example.txt"
348 348
349## Nil Coalescing 349## Nil Coalescing
350 350
351The nil-coalescing operator **??** returns the value of its left-hand operand if it isn't **nil**; otherwise, it evaluates the right-hand operand and returns its result. The **??** operator doesn't evaluate its right-hand operand if the left-hand operand evaluates to non-nil. 351Operator nil-coalescing **??** mengembalikan nilai dari operan kiri jika bukan **nil**; jika tidak, operator mengevaluasi operan kanan dan mengembalikan hasilnya. Operator **??** tidak mengevaluasi operan kanan jika operan kiri bernilai non-nil.
352```yuescript 352```yuescript
353local a, b, c, d 353local a, b, c, d
354a = b ?? c ?? d 354a = b ?? c ?? d
@@ -367,31 +367,31 @@ a ??= false
367 367
368</YueDisplay> 368</YueDisplay>
369 369
370## Implicit Object 370## Objek Implisit
371 371
372You can write a list of implicit structures that starts with the symbol **\*** or **-** inside a table block. If you are creating implicit object, the fields of the object must be with the same indent. 372Anda dapat menulis daftar struktur implisit yang diawali simbol **\*** atau **-** di dalam blok tabel. Jika Anda membuat objek implisit, field objek harus berada pada indentasi yang sama.
373 373
374```yuescript 374```yuescript
375-- assignment with implicit object 375-- assignment dengan objek implisit
376list = 376list =
377 * 1 377 * 1
378 * 2 378 * 2
379 * 3 379 * 3
380 380
381-- function call with implicit object 381-- pemanggilan fungsi dengan objek implisit
382func 382func
383 * 1 383 * 1
384 * 2 384 * 2
385 * 3 385 * 3
386 386
387-- return with implicit object 387-- return dengan objek implisit
388f = -> 388f = ->
389 return 389 return
390 * 1 390 * 1
391 * 2 391 * 2
392 * 3 392 * 3
393 393
394-- table with implicit object 394-- tabel dengan objek implisit
395tb = 395tb =
396 name: "abc" 396 name: "abc"
397 397
@@ -416,26 +416,26 @@ tb =
416<YueDisplay> 416<YueDisplay>
417 417
418```yue 418```yue
419-- assignment with implicit object 419-- assignment dengan objek implisit
420list = 420list =
421 * 1 421 * 1
422 * 2 422 * 2
423 * 3 423 * 3
424 424
425-- function call with implicit object 425-- pemanggilan fungsi dengan objek implisit
426func 426func
427 * 1 427 * 1
428 * 2 428 * 2
429 * 3 429 * 3
430 430
431-- return with implicit object 431-- return dengan objek implisit
432f = -> 432f = ->
433 return 433 return
434 * 1 434 * 1
435 * 2 435 * 2
436 * 3 436 * 3
437 437
438-- table with implicit object 438-- tabel dengan objek implisit
439tb = 439tb =
440 name: "abc" 440 name: "abc"
441 441
diff --git a/doc/docs/id-id/doc/language-basics/whitespace.md b/doc/docs/id-id/doc/language-basics/whitespace.md
index d742a2b..bdc124e 100644
--- a/doc/docs/id-id/doc/language-basics/whitespace.md
+++ b/doc/docs/id-id/doc/language-basics/whitespace.md
@@ -1,10 +1,10 @@
1# Whitespace 1# Spasi Kosong
2 2
3YueScript is a whitespace significant language. You have to write some code block in the same indent with space **' '** or tab **'\t'** like function body, value list and some control blocks. And expressions containing different whitespaces might mean different things. Tab is treated like 4 space, but it's better not mix the use of spaces and tabs. 3YueScript adalah bahasa yang peka terhadap spasi. Anda harus menulis beberapa blok kode dengan indentasi yang sama menggunakan spasi **' '** atau tab **'\t'** seperti badan fungsi, daftar nilai, dan beberapa blok kontrol. Ekspresi yang mengandung spasi berbeda dapat bermakna berbeda. Tab diperlakukan seperti 4 spasi, tetapi sebaiknya jangan mencampur penggunaan spasi dan tab.
4 4
5## Statement Separator 5## Pemisah Pernyataan
6 6
7A statement normally ends at a line break. You can also use a semicolon `;` to explicitly terminate a statement, which allows writing multiple statements on the same line: 7Sebuah pernyataan biasanya berakhir pada pergantian baris. Anda juga bisa memakai titik koma `;` untuk mengakhiri pernyataan secara eksplisit, yang memungkinkan menulis beberapa pernyataan pada satu baris:
8 8
9```yuescript 9```yuescript
10a = 1; b = 2; print a + b 10a = 1; b = 2; print a + b
@@ -17,9 +17,9 @@ a = 1; b = 2; print a + b
17 17
18</YueDisplay> 18</YueDisplay>
19 19
20## Multiline Chaining 20## Rantai Multibaris
21 21
22You can write multi-line chaining function calls with a same indent. 22Anda bisa menulis pemanggilan fungsi berantai multi-baris dengan indentasi yang sama.
23 23
24```yuescript 24```yuescript
25Rx.Observable 25Rx.Observable
diff --git a/doc/docs/id-id/doc/objects/object-oriented-programming.md b/doc/docs/id-id/doc/objects/object-oriented-programming.md
index 6a8559e..96c19d7 100644
--- a/doc/docs/id-id/doc/objects/object-oriented-programming.md
+++ b/doc/docs/id-id/doc/objects/object-oriented-programming.md
@@ -1,8 +1,8 @@
1# Object Oriented Programming 1# Pemrograman Berorientasi Objek
2 2
3In these examples, the generated Lua code may appear overwhelming. It is best to focus on the meaning of the YueScript code at first, then look into the Lua code if you wish to know the implementation details. 3Dalam contoh-contoh ini, kode Lua yang dihasilkan mungkin tampak berat. Sebaiknya fokus dulu pada makna kode YueScript, lalu lihat kode Lua jika Anda ingin mengetahui detail implementasinya.
4 4
5A simple class: 5Kelas sederhana:
6 6
7```yuescript 7```yuescript
8class Inventory 8class Inventory
@@ -31,15 +31,15 @@ class Inventory
31 31
32</YueDisplay> 32</YueDisplay>
33 33
34A class is declared with a class statement followed by a table-like declaration where all of the methods and properties are listed. 34Kelas dideklarasikan dengan pernyataan `class` diikuti deklarasi mirip tabel di mana semua method dan properti dicantumkan.
35 35
36The new property is special in that it will become the constructor. 36Properti `new` bersifat khusus karena akan menjadi konstruktor.
37 37
38Notice how all the methods in the class use the fat arrow function syntax. When calling methods on a instance, the instance itself is sent in as the first argument. The fat arrow handles the creation of a self argument. 38Perhatikan bahwa semua method di kelas menggunakan sintaks fungsi panah tebal. Saat memanggil method pada instance, instance itu sendiri dikirim sebagai argumen pertama. Panah tebal menangani pembuatan argumen `self`.
39 39
40The @ prefix on a variable name is shorthand for self.. @items becomes self.items. 40Prefiks `@` pada nama variabel adalah singkatan untuk `self.`. `@items` menjadi `self.items`.
41 41
42Creating an instance of the class is done by calling the name of the class as a function. 42Membuat instance kelas dilakukan dengan memanggil nama kelas sebagai fungsi.
43 43
44```yuescript 44```yuescript
45inv = Inventory! 45inv = Inventory!
@@ -56,11 +56,11 @@ inv\add_item "pants"
56 56
57</YueDisplay> 57</YueDisplay>
58 58
59Because the instance of the class needs to be sent to the methods when they are called, the \ operator is used. 59Karena instance kelas perlu dikirim ke method saat dipanggil, operator `\` digunakan.
60 60
61All properties of a class are shared among the instances. This is fine for functions, but for other types of objects, undesired results may occur. 61Semua properti kelas dibagikan di antara instance. Ini baik untuk fungsi, tetapi untuk jenis objek lain dapat menimbulkan hasil yang tidak diinginkan.
62 62
63Consider the example below, the clothes property is shared amongst all instances, so modifications to it in one instance will show up in another: 63Pertimbangkan contoh di bawah ini, properti `clothes` dibagikan di antara semua instance, sehingga perubahan di satu instance akan terlihat di instance lainnya:
64 64
65```yuescript 65```yuescript
66class Person 66class Person
@@ -74,7 +74,7 @@ b = Person!
74a\give_item "pants" 74a\give_item "pants"
75b\give_item "shirt" 75b\give_item "shirt"
76 76
77-- will print both pants and shirt 77-- akan mencetak pants dan shirt
78print item for item in *a.clothes 78print item for item in *a.clothes
79``` 79```
80<YueDisplay> 80<YueDisplay>
@@ -91,13 +91,13 @@ b = Person!
91a\give_item "pants" 91a\give_item "pants"
92b\give_item "shirt" 92b\give_item "shirt"
93 93
94-- will print both pants and shirt 94-- akan mencetak pants dan shirt
95print item for item in *a.clothes 95print item for item in *a.clothes
96``` 96```
97 97
98</YueDisplay> 98</YueDisplay>
99 99
100The proper way to avoid this problem is to create the mutable state of the object in the constructor: 100Cara yang benar untuk menghindari masalah ini adalah membuat state yang dapat berubah di konstruktor:
101 101
102```yuescript 102```yuescript
103class Person 103class Person
@@ -114,9 +114,9 @@ class Person
114 114
115</YueDisplay> 115</YueDisplay>
116 116
117## Inheritance 117## Pewarisan
118 118
119The extends keyword can be used in a class declaration to inherit the properties and methods from another class. 119Kata kunci `extends` dapat digunakan dalam deklarasi kelas untuk mewarisi properti dan method dari kelas lain.
120 120
121```yuescript 121```yuescript
122class BackPack extends Inventory 122class BackPack extends Inventory
@@ -137,18 +137,18 @@ class BackPack extends Inventory
137 137
138</YueDisplay> 138</YueDisplay>
139 139
140Here we extend our Inventory class, and limit the amount of items it can carry. 140Di sini kita memperluas kelas Inventory, dan membatasi jumlah item yang bisa dibawa.
141 141
142In this example, we don't define a constructor on the subclass, so the parent class' constructor is called when we make a new instance. If we did define a constructor then we can use the super method to call the parent constructor. 142Dalam contoh ini, kita tidak mendefinisikan konstruktor pada subclass, sehingga konstruktor kelas induk dipanggil ketika membuat instance baru. Jika kita mendefinisikan konstruktor, kita bisa menggunakan method `super` untuk memanggil konstruktor induk.
143 143
144Whenever a class inherits from another, it sends a message to the parent class by calling the method __inherited on the parent class if it exists. The function receives two arguments, the class that is being inherited and the child class. 144Setiap kali sebuah kelas mewarisi dari kelas lain, ia mengirim pesan ke kelas induk dengan memanggil method `__inherited` pada kelas induk jika ada. Fungsi menerima dua argumen, kelas yang diwarisi dan kelas anak.
145 145
146```yuescript 146```yuescript
147class Shelf 147class Shelf
148 @__inherited: (child) => 148 @__inherited: (child) =>
149 print @__name, "was inherited by", child.__name 149 print @__name, "was inherited by", child.__name
150 150
151-- will print: Shelf was inherited by Cupboard 151-- akan mencetak: Shelf was inherited by Cupboard
152class Cupboard extends Shelf 152class Cupboard extends Shelf
153``` 153```
154<YueDisplay> 154<YueDisplay>
@@ -158,7 +158,7 @@ class Shelf
158 @__inherited: (child) => 158 @__inherited: (child) =>
159 print @__name, "was inherited by", child.__name 159 print @__name, "was inherited by", child.__name
160 160
161-- will print: Shelf was inherited by Cupboard 161-- akan mencetak: Shelf was inherited by Cupboard
162class Cupboard extends Shelf 162class Cupboard extends Shelf
163``` 163```
164 164
@@ -166,27 +166,27 @@ class Cupboard extends Shelf
166 166
167## Super 167## Super
168 168
169**super** is a special keyword that can be used in two different ways: It can be treated as an object, or it can be called like a function. It only has special functionality when inside a class. 169**super** adalah kata kunci khusus yang dapat digunakan dengan dua cara: sebagai objek, atau dipanggil seperti fungsi. Ia hanya memiliki fungsi khusus ketika berada di dalam kelas.
170 170
171When called as a function, it will call the function of the same name in the parent class. The current self will automatically be passed as the first argument. (As seen in the inheritance example above) 171Ketika dipanggil sebagai fungsi, ia akan memanggil fungsi dengan nama yang sama di kelas induk. `self` saat ini akan otomatis dikirim sebagai argumen pertama. (Seperti pada contoh pewarisan di atas)
172 172
173When super is used as a normal value, it is a reference to the parent class object. 173Ketika `super` digunakan sebagai nilai normal, ia merupakan referensi ke objek kelas induk.
174 174
175It can be accessed like any of object in order to retrieve values in the parent class that might have been shadowed by the child class. 175Ia dapat diakses seperti objek biasa untuk mengambil nilai di kelas induk yang mungkin tertutup oleh kelas anak.
176 176
177When the \ calling operator is used with super, self is inserted as the first argument instead of the value of super itself. When using . to retrieve a function, the raw function is returned. 177Ketika operator pemanggilan `\` digunakan dengan `super`, `self` disisipkan sebagai argumen pertama alih-alih nilai `super` itu sendiri. Saat menggunakan `.` untuk mengambil fungsi, fungsi mentah dikembalikan.
178 178
179A few examples of using super in different ways: 179Beberapa contoh penggunaan `super` dengan cara berbeda:
180 180
181```yuescript 181```yuescript
182class MyClass extends ParentClass 182class MyClass extends ParentClass
183 a_method: => 183 a_method: =>
184 -- the following have the same effect: 184 -- berikut memiliki efek yang sama:
185 super "hello", "world" 185 super "hello", "world"
186 super\a_method "hello", "world" 186 super\a_method "hello", "world"
187 super.a_method self, "hello", "world" 187 super.a_method self, "hello", "world"
188 188
189 -- super as a value is equal to the parent class: 189 -- super sebagai nilai sama dengan kelas induk:
190 assert super == ParentClass 190 assert super == ParentClass
191``` 191```
192<YueDisplay> 192<YueDisplay>
@@ -194,28 +194,28 @@ class MyClass extends ParentClass
194```yue 194```yue
195class MyClass extends ParentClass 195class MyClass extends ParentClass
196 a_method: => 196 a_method: =>
197 -- the following have the same effect: 197 -- berikut memiliki efek yang sama:
198 super "hello", "world" 198 super "hello", "world"
199 super\a_method "hello", "world" 199 super\a_method "hello", "world"
200 super.a_method self, "hello", "world" 200 super.a_method self, "hello", "world"
201 201
202 -- super as a value is equal to the parent class: 202 -- super sebagai nilai sama dengan kelas induk:
203 assert super == ParentClass 203 assert super == ParentClass
204``` 204```
205 205
206</YueDisplay> 206</YueDisplay>
207 207
208**super** can also be used on left side of a Function Stub. The only major difference is that instead of the resulting function being bound to the value of super, it is bound to self. 208**super** juga dapat digunakan di sisi kiri Function Stub. Perbedaan utamanya adalah, alih-alih fungsi hasil terikat pada nilai `super`, fungsi terikat pada `self`.
209 209
210## Types 210## Tipe
211 211
212Every instance of a class carries its type with it. This is stored in the special __class property. This property holds the class object. The class object is what we call to build a new instance. We can also index the class object to retrieve class methods and properties. 212Setiap instance kelas membawa tipenya sendiri. Ini disimpan di properti khusus `__class`. Properti ini memuat objek kelas. Objek kelas adalah yang kita panggil untuk membuat instance baru. Kita juga dapat mengindeks objek kelas untuk mengambil method dan properti kelas.
213 213
214```yuescript 214```yuescript
215b = BackPack! 215b = BackPack!
216assert b.__class == BackPack 216assert b.__class == BackPack
217 217
218print BackPack.size -- prints 10 218print BackPack.size -- mencetak 10
219``` 219```
220<YueDisplay> 220<YueDisplay>
221 221
@@ -223,45 +223,45 @@ print BackPack.size -- prints 10
223b = BackPack! 223b = BackPack!
224assert b.__class == BackPack 224assert b.__class == BackPack
225 225
226print BackPack.size -- prints 10 226print BackPack.size -- mencetak 10
227``` 227```
228 228
229</YueDisplay> 229</YueDisplay>
230 230
231## Class Objects 231## Objek Kelas
232 232
233The class object is what we create when we use a class statement. The class object is stored in a variable of the same name of the class. 233Objek kelas adalah yang kita buat saat menggunakan pernyataan `class`. Objek kelas disimpan dalam variabel dengan nama yang sama dengan kelas.
234 234
235The class object can be called like a function in order to create new instances. That's how we created instances of classes in the examples above. 235Objek kelas dapat dipanggil seperti fungsi untuk membuat instance baru. Begitulah cara kita membuat instance kelas pada contoh di atas.
236 236
237A class is made up of two tables. The class table itself, and the base table. The base is used as the metatable for all the instances. All properties listed in the class declaration are placed in the base. 237Sebuah kelas terdiri dari dua tabel: tabel kelas itu sendiri dan tabel base. Base digunakan sebagai metatable untuk semua instance. Semua properti yang dicantumkan dalam deklarasi kelas ditempatkan di base.
238 238
239The class object's metatable reads properties from the base if they don't exist in the class object. This means we can access functions and properties directly from the class. 239Metatable objek kelas membaca properti dari base jika tidak ada di objek kelas. Ini berarti kita dapat mengakses fungsi dan properti langsung dari kelas.
240 240
241It is important to note that assigning to the class object does not assign into the base, so it's not a valid way to add new methods to instances. Instead the base must explicitly be changed. See the __base field below. 241Penting untuk dicatat bahwa assignment ke objek kelas tidak meng-assign ke base, sehingga itu bukan cara yang valid untuk menambahkan method baru ke instance. Sebagai gantinya, base harus diubah secara eksplisit. Lihat field `__base` di bawah.
242 242
243The class object has a couple special properties: 243Objek kelas memiliki beberapa properti khusus:
244 244
245The name of the class as when it was declared is stored as a string in the __name field of the class object. 245Nama kelas saat dideklarasikan disimpan sebagai string di field `__name` pada objek kelas.
246 246
247```yuescript 247```yuescript
248print BackPack.__name -- prints Backpack 248print BackPack.__name -- mencetak Backpack
249``` 249```
250<YueDisplay> 250<YueDisplay>
251 251
252```yue 252```yue
253print BackPack.__name -- prints Backpack 253print BackPack.__name -- mencetak Backpack
254``` 254```
255 255
256</YueDisplay> 256</YueDisplay>
257 257
258The base object is stored in __base. We can modify this table to add functionality to instances that have already been created and ones that are yet to be created. 258Objek base disimpan di `__base`. Kita dapat memodifikasi tabel ini untuk menambahkan fungsionalitas ke instance yang sudah dibuat maupun yang akan dibuat.
259 259
260If the class extends from anything, the parent class object is stored in __parent. 260Jika kelas memperluas kelas lain, objek kelas induk disimpan di `__parent`.
261 261
262## Class Variables 262## Variabel Kelas
263 263
264We can create variables directly in the class object instead of in the base by using @ in the front of the property name in a class declaration. 264Kita dapat membuat variabel langsung di objek kelas alih-alih di base dengan menggunakan `@` di depan nama properti pada deklarasi kelas.
265 265
266```yuescript 266```yuescript
267class Things 267class Things
@@ -269,7 +269,7 @@ class Things
269 269
270Things\some_func! 270Things\some_func!
271 271
272-- class variables not visible in instances 272-- variabel kelas tidak terlihat pada instance
273assert Things().some_func == nil 273assert Things().some_func == nil
274``` 274```
275<YueDisplay> 275<YueDisplay>
@@ -280,13 +280,13 @@ class Things
280 280
281Things\some_func! 281Things\some_func!
282 282
283-- class variables not visible in instances 283-- variabel kelas tidak terlihat pada instance
284assert Things().some_func == nil 284assert Things().some_func == nil
285``` 285```
286 286
287</YueDisplay> 287</YueDisplay>
288 288
289In expressions, we can use @@ to access a value that is stored in the __class of self. Thus, @@hello is shorthand for self.__class.hello. 289Dalam ekspresi, kita dapat menggunakan `@@` untuk mengakses nilai yang disimpan di `__class` milik `self`. Jadi, `@@hello` adalah singkatan dari `self.__class.hello`.
290 290
291```yuescript 291```yuescript
292class Counter 292class Counter
@@ -298,7 +298,7 @@ class Counter
298Counter! 298Counter!
299Counter! 299Counter!
300 300
301print Counter.count -- prints 2 301print Counter.count -- mencetak 2
302``` 302```
303<YueDisplay> 303<YueDisplay>
304 304
@@ -312,12 +312,12 @@ class Counter
312Counter! 312Counter!
313Counter! 313Counter!
314 314
315print Counter.count -- prints 2 315print Counter.count -- mencetak 2
316``` 316```
317 317
318</YueDisplay> 318</YueDisplay>
319 319
320The calling semantics of @@ are similar to @. Calling a @@ name will pass the class in as the first argument using Lua's colon syntax. 320Semantik pemanggilan `@@` mirip dengan `@`. Memanggil nama `@@` akan meneruskan kelas sebagai argumen pertama menggunakan sintaks kolon Lua.
321 321
322```yuescript 322```yuescript
323@@hello 1,2,3,4 323@@hello 1,2,3,4
@@ -330,11 +330,11 @@ The calling semantics of @@ are similar to @. Calling a @@ name will pass the cl
330 330
331</YueDisplay> 331</YueDisplay>
332 332
333## Class Declaration Statements 333## Pernyataan Deklarasi Kelas
334 334
335In the body of a class declaration, we can have normal expressions in addition to key/value pairs. In this context, self is equal to the class object. 335Di dalam badan deklarasi kelas, kita bisa memiliki ekspresi normal selain pasangan key/value. Dalam konteks ini, `self` sama dengan objek kelas.
336 336
337Here is an alternative way to create a class variable compared to what's described above: 337Berikut cara alternatif untuk membuat variabel kelas dibandingkan yang dijelaskan di atas:
338 338
339```yuescript 339```yuescript
340class Things 340class Things
@@ -349,9 +349,9 @@ class Things
349 349
350</YueDisplay> 350</YueDisplay>
351 351
352These expressions are executed after all the properties have been added to the base. 352Ekspresi ini dieksekusi setelah semua properti ditambahkan ke base.
353 353
354All variables declared in the body of the class are local to the classes properties. This is convenient for placing private values or helper functions that only the class methods can access: 354Semua variabel yang dideklarasikan di badan kelas bersifat lokal terhadap properti kelas. Ini berguna untuk menempatkan nilai privat atau fungsi pembantu yang hanya dapat diakses oleh method kelas:
355 355
356```yuescript 356```yuescript
357class MoreThings 357class MoreThings
@@ -374,11 +374,11 @@ class MoreThings
374 374
375</YueDisplay> 375</YueDisplay>
376 376
377## @ and @@ Values 377## Nilai @ dan @@
378 378
379When @ and @@ are prefixed in front of a name they represent, respectively, that name accessed in self and self.__class. 379Ketika `@` dan `@@` diprefiks di depan sebuah nama, masing-masing merepresentasikan nama tersebut yang diakses di `self` dan `self.__class`.
380 380
381If they are used all by themselves, they are aliases for self and self.__class. 381Jika digunakan sendirian, keduanya adalah alias untuk `self` dan `self.__class`.
382 382
383```yuescript 383```yuescript
384assert @ == self 384assert @ == self
@@ -393,7 +393,7 @@ assert @@ == self.__class
393 393
394</YueDisplay> 394</YueDisplay>
395 395
396For example, a quick way to create a new instance of the same class from an instance method using @@: 396Contohnya, cara cepat untuk membuat instance baru dari kelas yang sama dari method instance menggunakan `@@`:
397 397
398```yuescript 398```yuescript
399some_instance_method = (...) => @@ ... 399some_instance_method = (...) => @@ ...
@@ -406,15 +406,15 @@ some_instance_method = (...) => @@ ...
406 406
407</YueDisplay> 407</YueDisplay>
408 408
409## Constructor Property Promotion 409## Promosi Properti Konstruktor
410 410
411To reduce the boilerplate code for definition of simple value objects. You can write a simple class like: 411Untuk mengurangi boilerplate saat mendefinisikan objek nilai sederhana, Anda dapat menulis kelas sederhana seperti:
412 412
413```yuescript 413```yuescript
414class Something 414class Something
415 new: (@foo, @bar, @@biz, @@baz) => 415 new: (@foo, @bar, @@biz, @@baz) =>
416 416
417-- Which is short for 417-- Yang merupakan singkatan dari
418 418
419class Something 419class Something
420 new: (foo, bar, biz, baz) => 420 new: (foo, bar, biz, baz) =>
@@ -429,7 +429,7 @@ class Something
429class Something 429class Something
430 new: (@foo, @bar, @@biz, @@baz) => 430 new: (@foo, @bar, @@biz, @@baz) =>
431 431
432-- Which is short for 432-- Yang merupakan singkatan dari
433 433
434class Something 434class Something
435 new: (foo, bar, biz, baz) => 435 new: (foo, bar, biz, baz) =>
@@ -441,7 +441,7 @@ class Something
441 441
442</YueDisplay> 442</YueDisplay>
443 443
444You can also use this syntax for a common function to initialize a object's fields. 444Anda juga bisa menggunakan sintaks ini untuk fungsi umum guna menginisialisasi field objek.
445 445
446```yuescript 446```yuescript
447new = (@fieldA, @fieldB) => @ 447new = (@fieldA, @fieldB) => @
@@ -458,9 +458,9 @@ print obj
458 458
459</YueDisplay> 459</YueDisplay>
460 460
461## Class Expressions 461## Ekspresi Kelas
462 462
463The class syntax can also be used as an expression which can be assigned to a variable or explicitly returned. 463Sintaks kelas juga bisa digunakan sebagai ekspresi yang dapat di-assign ke variabel atau di-return secara eksplisit.
464 464
465```yuescript 465```yuescript
466x = class Bucket 466x = class Bucket
@@ -477,9 +477,9 @@ x = class Bucket
477 477
478</YueDisplay> 478</YueDisplay>
479 479
480## Anonymous classes 480## Kelas Anonim
481 481
482The name can be left out when declaring a class. The __name attribute will be nil, unless the class expression is in an assignment. The name on the left hand side of the assignment is used instead of nil. 482Nama bisa dihilangkan saat mendeklarasikan kelas. Atribut `__name` akan bernilai nil, kecuali ekspresi kelas berada dalam assignment. Nama di sisi kiri assignment digunakan sebagai ganti nil.
483 483
484```yuescript 484```yuescript
485BigBucket = class extends Bucket 485BigBucket = class extends Bucket
@@ -498,7 +498,7 @@ assert Bucket.__name == "BigBucket"
498 498
499</YueDisplay> 499</YueDisplay>
500 500
501You can even leave off the body, meaning you can write a blank anonymous class like this: 501Anda bahkan bisa menghilangkan badan kelas, artinya Anda bisa menulis kelas anonim kosong seperti ini:
502 502
503```yuescript 503```yuescript
504x = class 504x = class
@@ -511,9 +511,9 @@ x = class
511 511
512</YueDisplay> 512</YueDisplay>
513 513
514## Class Mixing 514## Pencampuran Kelas
515 515
516You can do mixing with keyword `using` to copy functions from either a plain table or a predefined class object into your new class. When doing mixing with a plain table, you can override the class indexing function (metamethod `__index`) to your customized implementation. When doing mixing with an existing class object, the class object's metamethods won't be copied. 516Anda bisa melakukan mixing dengan kata kunci `using` untuk menyalin fungsi dari tabel biasa atau objek kelas yang sudah didefinisikan ke kelas baru Anda. Saat mixing dengan tabel biasa, Anda dapat mengganti fungsi pengindeksan kelas (metamethod `__index`) dengan implementasi kustom. Saat mixing dengan objek kelas yang sudah ada, metamethod objek kelas tidak akan disalin.
517 517
518```yuescript 518```yuescript
519MyIndex = __index: var: 1 519MyIndex = __index: var: 1
@@ -530,7 +530,7 @@ class Y using X
530y = Y! 530y = Y!
531y\func! 531y\func!
532 532
533assert y.__class.__parent ~= X -- X is not parent of Y 533assert y.__class.__parent ~= X -- X bukan parent dari Y
534``` 534```
535<YueDisplay> 535<YueDisplay>
536 536
@@ -549,7 +549,7 @@ class Y using X
549y = Y! 549y = Y!
550y\func! 550y\func!
551 551
552assert y.__class.__parent ~= X -- X is not parent of Y 552assert y.__class.__parent ~= X -- X bukan parent dari Y
553``` 553```
554 554
555</YueDisplay> 555</YueDisplay>
diff --git a/doc/docs/id-id/doc/objects/with-statement.md b/doc/docs/id-id/doc/objects/with-statement.md
index 7786803..3c0a8a5 100644
--- a/doc/docs/id-id/doc/objects/with-statement.md
+++ b/doc/docs/id-id/doc/objects/with-statement.md
@@ -1,13 +1,12 @@
1# With Statement 1# Pernyataan With
2 2
3Pola umum saat membuat objek adalah memanggil serangkaian fungsi dan mengatur serangkaian properti segera setelah objek dibuat.
3 4
4A common pattern involving the creation of an object is calling a series of functions and setting a series of properties immediately after creating it. 5Hal ini menyebabkan nama objek diulang berkali-kali di kode, menambah noise yang tidak perlu. Solusi umum untuk ini adalah meneruskan tabel sebagai argumen yang berisi kumpulan kunci dan nilai untuk ditimpa. Kekurangannya adalah konstruktor objek harus mendukung bentuk ini.
5 6
6This results in repeating the name of the object multiple times in code, adding unnecessary noise. A common solution to this is to pass a table in as an argument which contains a collection of keys and values to overwrite. The downside to this is that the constructor of this object must support this form. 7Blok `with` membantu mengatasi hal ini. Di dalam blok `with`, kita bisa menggunakan pernyataan khusus yang diawali dengan `.` atau `\` yang merepresentasikan operasi tersebut diterapkan pada objek yang sedang dipakai.
7 8
8The with block helps to alleviate this. Within a with block we can use a special statements that begin with either . or \ which represent those operations applied to the object we are using with on. 9Sebagai contoh, kita bekerja dengan objek yang baru dibuat:
9
10For example, we work with a newly created object:
11 10
12```yuescript 11```yuescript
13with Person! 12with Person!
@@ -28,7 +27,7 @@ with Person!
28 27
29</YueDisplay> 28</YueDisplay>
30 29
31The with statement can also be used as an expression which returns the value it has been giving access to. 30Pernyataan `with` juga bisa digunakan sebagai ekspresi yang mengembalikan nilai yang diberi akses.
32 31
33```yuescript 32```yuescript
34file = with File "favorite_foods.txt" 33file = with File "favorite_foods.txt"
@@ -43,7 +42,7 @@ file = with File "favorite_foods.txt"
43 42
44</YueDisplay> 43</YueDisplay>
45 44
46Or 45Atau
47 46
48```yuescript 47```yuescript
49create_person = (name, relatives) -> 48create_person = (name, relatives) ->
@@ -66,9 +65,9 @@ me = create_person "Leaf", [dad, mother, sister]
66 65
67</YueDisplay> 66</YueDisplay>
68 67
69In this usage, with can be seen as a special form of the K combinator. 68Dalam penggunaan ini, `with` dapat dilihat sebagai bentuk khusus dari kombinator K.
70 69
71The expression in the with statement can also be an assignment, if you want to give a name to the expression. 70Ekspresi pada pernyataan `with` juga bisa berupa assignment jika Anda ingin memberi nama pada ekspresi tersebut.
72 71
73```yuescript 72```yuescript
74with str := "Hello" 73with str := "Hello"
@@ -85,7 +84,7 @@ with str := "Hello"
85 84
86</YueDisplay> 85</YueDisplay>
87 86
88You can access special keys with `[]` in a `with` statement. 87Anda bisa mengakses kunci khusus dengan `[]` di dalam pernyataan `with`.
89 88
90```yuescript 89```yuescript
91with tb 90with tb
@@ -94,7 +93,7 @@ with tb
94 with [abc] 93 with [abc]
95 [3] = [2]\func! 94 [3] = [2]\func!
96 ["key-name"] = value 95 ["key-name"] = value
97 [] = "abc" -- appending to "tb" 96 [] = "abc" -- menambahkan ke "tb"
98``` 97```
99<YueDisplay> 98<YueDisplay>
100 99
@@ -105,12 +104,12 @@ with tb
105 with [abc] 104 with [abc]
106 [3] = [2]\func! 105 [3] = [2]\func!
107 ["key-name"] = value 106 ["key-name"] = value
108 [] = "abc" -- appending to "tb" 107 [] = "abc" -- menambahkan ke "tb"
109``` 108```
110 109
111</YueDisplay> 110</YueDisplay>
112 111
113`with?` is an enhanced version of `with` syntax, which introduces an existential check to safely access objects that may be nil without explicit null checks. 112`with?` adalah versi yang ditingkatkan dari sintaks `with`, yang memperkenalkan pengecekan keberadaan untuk mengakses objek yang mungkin nil secara aman tanpa pemeriksaan null eksplisit.
114 113
115```yuescript 114```yuescript
116with? obj 115with? obj
diff --git a/doc/docs/id-id/doc/reference/license-mit.md b/doc/docs/id-id/doc/reference/license-mit.md
index f1d5d60..5289f50 100644
--- a/doc/docs/id-id/doc/reference/license-mit.md
+++ b/doc/docs/id-id/doc/reference/license-mit.md
@@ -1,23 +1,22 @@
1# License: MIT 1# Lisensi: MIT
2 2
3Copyright (c) 2017-2026 Li Jin \<dragon-fly@qq.com\> 3Copyright (c) 2017-2026 Li Jin <dragon-fly@qq.com>
4 4
5Permission is hereby granted, free of charge, to any person obtaining a copy 5Izin dengan ini diberikan, tanpa biaya, kepada siapa pun yang memperoleh salinan
6of this software and associated documentation files (the "Software"), to deal 6perangkat lunak ini beserta file dokumentasi terkait ("Perangkat Lunak"), untuk
7in the Software without restriction, including without limitation the rights 7berurusan dengan Perangkat Lunak tanpa pembatasan, termasuk tanpa batasan hak
8to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8untuk menggunakan, menyalin, memodifikasi, menggabungkan, menerbitkan,
9copies of the Software, and to permit persons to whom the Software is 9mendistribusikan, mensublisensikan, dan/atau menjual salinan Perangkat Lunak,
10furnished to do so, subject to the following conditions: 10dan untuk mengizinkan orang yang menerima Perangkat Lunak untuk melakukannya,
11dengan syarat-syarat berikut:
11 12
12The above copyright notice and this permission notice shall be included in all 13Pemberitahuan hak cipta di atas dan pemberitahuan izin ini harus disertakan dalam
13copies or substantial portions of the Software. 14semua salinan atau bagian substansial dari Perangkat Lunak.
14 15
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16PERANGKAT LUNAK DISEDIAKAN "APA ADANYA", TANPA JAMINAN APA PUN, BAIK TERSURAT
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17MAUPUN TERSIRAT, TERMASUK NAMUN TIDAK TERBATAS PADA JAMINAN KELAYAKAN
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18DIPERDAGANGKAN, KESESUAIAN UNTUK TUJUAN TERTENTU, DAN TIDAK MELANGGAR HAK.
18AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19DALAM KEADAAN APA PUN, PENULIS ATAU PEMEGANG HAK CIPTA TIDAK BERTANGGUNG JAWAB
19LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20ATAS KLAIM, KERUSAKAN, ATAU KEWAJIBAN LAINNYA, BAIK DALAM TINDAKAN KONTRAK,
20OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21PERBUATAN MELAWAN HUKUM, ATAU LAINNYA, YANG TIMBUL DARI, DI LUAR, ATAU TERKAIT
21SOFTWARE. 22DENGAN PERANGKAT LUNAK ATAU PENGGUNAAN ATAU URUSAN LAIN DALAM PERANGKAT LUNAK.
22
23<CompilerModal />
diff --git a/doc/docs/id-id/doc/reference/the-yuescript-library.md b/doc/docs/id-id/doc/reference/the-yuescript-library.md
index 3761755..0a398a5 100644
--- a/doc/docs/id-id/doc/reference/the-yuescript-library.md
+++ b/doc/docs/id-id/doc/reference/the-yuescript-library.md
@@ -1,20 +1,20 @@
1# The YueScript Library 1# Pustaka YueScript
2 2
3Access it by `local yue = require("yue")` in Lua. 3Akses dengan `local yue = require("yue")` di Lua.
4 4
5## yue 5## yue
6 6
7**Description:** 7**Deskripsi:**
8 8
9The YueScript language library. 9Pustaka bahasa YueScript.
10 10
11### version 11### version
12 12
13**Type:** Field. 13**Tipe:** Field.
14 14
15**Description:** 15**Deskripsi:**
16 16
17The YueScript version. 17Versi YueScript.
18 18
19**Signature:** 19**Signature:**
20```lua 20```lua
@@ -23,11 +23,11 @@ version: string
23 23
24### dirsep 24### dirsep
25 25
26**Type:** Field. 26**Tipe:** Field.
27 27
28**Description:** 28**Deskripsi:**
29 29
30The file separator for the current platform. 30Pemisah file untuk platform saat ini.
31 31
32**Signature:** 32**Signature:**
33```lua 33```lua
@@ -36,11 +36,11 @@ dirsep: string
36 36
37### yue_compiled 37### yue_compiled
38 38
39**Type:** Field. 39**Tipe:** Field.
40 40
41**Description:** 41**Deskripsi:**
42 42
43The compiled module code cache. 43Cache kode modul yang telah dikompilasi.
44 44
45**Signature:** 45**Signature:**
46```lua 46```lua
@@ -49,11 +49,11 @@ yue_compiled: {string: string}
49 49
50### to_lua 50### to_lua
51 51
52**Type:** Function. 52**Tipe:** Function.
53 53
54**Description:** 54**Deskripsi:**
55 55
56The YueScript compiling function. It compiles the YueScript code to Lua code. 56Fungsi kompilasi YueScript. Mengompilasi kode YueScript menjadi kode Lua.
57 57
58**Signature:** 58**Signature:**
59```lua 59```lua
@@ -63,122 +63,122 @@ to_lua: function(code: string, config?: Config):
63 --[[globals]] {{string, integer, integer}} | nil 63 --[[globals]] {{string, integer, integer}} | nil
64``` 64```
65 65
66**Parameters:** 66**Parameter:**
67 67
68| Parameter | Type | Description | 68| Parameter | Tipe | Deskripsi |
69| --- | --- | --- | 69| --- | --- | --- |
70| code | string | The YueScript code. | 70| code | string | Kode YueScript. |
71| config | Config | [Optional] The compiler options. | 71| config | Config | [Opsional] Opsi kompiler. |
72 72
73**Returns:** 73**Return:**
74 74
75| Return Type | Description | 75| Tipe Return | Deskripsi |
76| --- | --- | 76| --- | --- |
77| string \| nil | The compiled Lua code, or nil if the compilation failed. | 77| string \| nil | Kode Lua hasil kompilasi, atau nil jika kompilasi gagal. |
78| string \| nil | The error message, or nil if the compilation succeeded. | 78| string \| nil | Pesan error, atau nil jika kompilasi berhasil. |
79| {{string, integer, integer}} \| nil | The global variables appearing in the code (with name, row and column), or nil if the compiler option `lint_global` is false. | 79| {{string, integer, integer}} \| nil | Variabel global yang muncul dalam kode (dengan nama, baris, dan kolom), atau nil jika opsi kompiler `lint_global` bernilai false. |
80 80
81### file_exist 81### file_exist
82 82
83**Type:** Function. 83**Tipe:** Function.
84 84
85**Description:** 85**Deskripsi:**
86 86
87The source file existence checking function. Can be overridden to customize the behavior. 87Fungsi untuk memeriksa keberadaan file sumber. Dapat ditimpa untuk menyesuaikan perilaku.
88 88
89**Signature:** 89**Signature:**
90```lua 90```lua
91file_exist: function(filename: string): boolean 91file_exist: function(filename: string): boolean
92``` 92```
93 93
94**Parameters:** 94**Parameter:**
95 95
96| Parameter | Type | Description | 96| Parameter | Tipe | Deskripsi |
97| --- | --- | --- | 97| --- | --- | --- |
98| filename | string | The file name. | 98| filename | string | Nama file. |
99 99
100**Returns:** 100**Return:**
101 101
102| Return Type | Description | 102| Tipe Return | Deskripsi |
103| --- | --- | 103| --- | --- |
104| boolean | Whether the file exists. | 104| boolean | Apakah file ada. |
105 105
106### read_file 106### read_file
107 107
108**Type:** Function. 108**Tipe:** Function.
109 109
110**Description:** 110**Deskripsi:**
111 111
112The source file reading function. Can be overridden to customize the behavior. 112Fungsi untuk membaca file sumber. Dapat ditimpa untuk menyesuaikan perilaku.
113 113
114**Signature:** 114**Signature:**
115```lua 115```lua
116read_file: function(filename: string): string 116read_file: function(filename: string): string
117``` 117```
118 118
119**Parameters:** 119**Parameter:**
120 120
121| Parameter | Type | Description | 121| Parameter | Tipe | Deskripsi |
122| --- | --- | --- | 122| --- | --- | --- |
123| filename | string | The file name. | 123| filename | string | Nama file. |
124 124
125**Returns:** 125**Return:**
126 126
127| Return Type | Description | 127| Tipe Return | Deskripsi |
128| --- | --- | 128| --- | --- |
129| string | The file content. | 129| string | Isi file. |
130 130
131### insert_loader 131### insert_loader
132 132
133**Type:** Function. 133**Tipe:** Function.
134 134
135**Description:** 135**Deskripsi:**
136 136
137Insert the YueScript loader to the package loaders (searchers). 137Menyisipkan loader YueScript ke package loaders (searchers).
138 138
139**Signature:** 139**Signature:**
140```lua 140```lua
141insert_loader: function(pos?: integer): boolean 141insert_loader: function(pos?: integer): boolean
142``` 142```
143 143
144**Parameters:** 144**Parameter:**
145 145
146| Parameter | Type | Description | 146| Parameter | Tipe | Deskripsi |
147| --- | --- | --- | 147| --- | --- | --- |
148| pos | integer | [Optional] The position to insert the loader. Default is 3. | 148| pos | integer | [Opsional] Posisi untuk menyisipkan loader. Default adalah 3. |
149 149
150**Returns:** 150**Return:**
151 151
152| Return Type | Description | 152| Tipe Return | Deskripsi |
153| --- | --- | 153| --- | --- |
154| boolean | Whether the loader is inserted successfully. It will fail if the loader is already inserted. | 154| boolean | Apakah loader berhasil disisipkan. Akan gagal jika loader sudah disisipkan. |
155 155
156### remove_loader 156### remove_loader
157 157
158**Type:** Function. 158**Tipe:** Function.
159 159
160**Description:** 160**Deskripsi:**
161 161
162Remove the YueScript loader from the package loaders (searchers). 162Menghapus loader YueScript dari package loaders (searchers).
163 163
164**Signature:** 164**Signature:**
165```lua 165```lua
166remove_loader: function(): boolean 166remove_loader: function(): boolean
167``` 167```
168 168
169**Returns:** 169**Return:**
170 170
171| Return Type | Description | 171| Tipe Return | Deskripsi |
172| --- | --- | 172| --- | --- |
173| boolean | Whether the loader is removed successfully. It will fail if the loader is not inserted. | 173| boolean | Apakah loader berhasil dihapus. Akan gagal jika loader belum disisipkan. |
174 174
175### loadstring 175### loadstring
176 176
177**Type:** Function. 177**Tipe:** Function.
178 178
179**Description:** 179**Deskripsi:**
180 180
181Loads YueScript code from a string into a function. 181Memuat kode YueScript dari string menjadi fungsi.
182 182
183**Signature:** 183**Signature:**
184```lua 184```lua
@@ -187,29 +187,29 @@ loadstring: function(input: string, chunkname: string, env: table, config?: Conf
187 --[[error]] string | nil 187 --[[error]] string | nil
188``` 188```
189 189
190**Parameters:** 190**Parameter:**
191 191
192| Parameter | Type | Description | 192| Parameter | Tipe | Deskripsi |
193| --- | --- | --- | 193| --- | --- | --- |
194| input | string | The YueScript code. | 194| input | string | Kode YueScript. |
195| chunkname | string | The name of the code chunk. | 195| chunkname | string | Nama chunk kode. |
196| env | table | The environment table. | 196| env | table | Tabel environment. |
197| config | Config | [Optional] The compiler options. | 197| config | Config | [Opsional] Opsi kompiler. |
198 198
199**Returns:** 199**Return:**
200 200
201| Return Type | Description | 201| Tipe Return | Deskripsi |
202| --- | --- | 202| --- | --- |
203| function \| nil | The loaded function, or nil if the loading failed. | 203| function \| nil | Fungsi yang dimuat, atau nil jika pemuatan gagal. |
204| string \| nil | The error message, or nil if the loading succeeded. | 204| string \| nil | Pesan error, atau nil jika pemuatan berhasil. |
205 205
206### loadstring 206### loadstring
207 207
208**Type:** Function. 208**Tipe:** Function.
209 209
210**Description:** 210**Deskripsi:**
211 211
212Loads YueScript code from a string into a function. 212Memuat kode YueScript dari string menjadi fungsi.
213 213
214**Signature:** 214**Signature:**
215```lua 215```lua
@@ -218,28 +218,28 @@ loadstring: function(input: string, chunkname: string, config?: Config):
218 --[[error]] string | nil 218 --[[error]] string | nil
219``` 219```
220 220
221**Parameters:** 221**Parameter:**
222 222
223| Parameter | Type | Description | 223| Parameter | Tipe | Deskripsi |
224| --- | --- | --- | 224| --- | --- | --- |
225| input | string | The YueScript code. | 225| input | string | Kode YueScript. |
226| chunkname | string | The name of the code chunk. | 226| chunkname | string | Nama chunk kode. |
227| config | Config | [Optional] The compiler options. | 227| config | Config | [Opsional] Opsi kompiler. |
228 228
229**Returns:** 229**Return:**
230 230
231| Return Type | Description | 231| Tipe Return | Deskripsi |
232| --- | --- | 232| --- | --- |
233| function \| nil | The loaded function, or nil if the loading failed. | 233| function \| nil | Fungsi yang dimuat, atau nil jika pemuatan gagal. |
234| string \| nil | The error message, or nil if the loading succeeded. | 234| string \| nil | Pesan error, atau nil jika pemuatan berhasil. |
235 235
236### loadstring 236### loadstring
237 237
238**Type:** Function. 238**Tipe:** Function.
239 239
240**Description:** 240**Deskripsi:**
241 241
242Loads YueScript code from a string into a function. 242Memuat kode YueScript dari string menjadi fungsi.
243 243
244**Signature:** 244**Signature:**
245```lua 245```lua
@@ -248,27 +248,27 @@ loadstring: function(input: string, config?: Config):
248 --[[error]] string | nil 248 --[[error]] string | nil
249``` 249```
250 250
251**Parameters:** 251**Parameter:**
252 252
253| Parameter | Type | Description | 253| Parameter | Tipe | Deskripsi |
254| --- | --- | --- | 254| --- | --- | --- |
255| input | string | The YueScript code. | 255| input | string | Kode YueScript. |
256| config | Config | [Optional] The compiler options. | 256| config | Config | [Opsional] Opsi kompiler. |
257 257
258**Returns:** 258**Return:**
259 259
260| Return Type | Description | 260| Tipe Return | Deskripsi |
261| --- | --- | 261| --- | --- |
262| function \| nil | The loaded function, or nil if the loading failed. | 262| function \| nil | Fungsi yang dimuat, atau nil jika pemuatan gagal. |
263| string \| nil | The error message, or nil if the loading succeeded. | 263| string \| nil | Pesan error, atau nil jika pemuatan berhasil. |
264 264
265### loadfile 265### loadfile
266 266
267**Type:** Function. 267**Tipe:** Function.
268 268
269**Description:** 269**Deskripsi:**
270 270
271Loads YueScript code from a file into a function. 271Memuat kode YueScript dari file menjadi fungsi.
272 272
273**Signature:** 273**Signature:**
274```lua 274```lua
@@ -277,28 +277,28 @@ loadfile: function(filename: string, env: table, config?: Config):
277 string | nil 277 string | nil
278``` 278```
279 279
280**Parameters:** 280**Parameter:**
281 281
282| Parameter | Type | Description | 282| Parameter | Tipe | Deskripsi |
283| --- | --- | --- | 283| --- | --- | --- |
284| filename | string | The file name. | 284| filename | string | Nama file. |
285| env | table | The environment table. | 285| env | table | Tabel environment. |
286| config | Config | [Optional] The compiler options. | 286| config | Config | [Opsional] Opsi kompiler. |
287 287
288**Returns:** 288**Return:**
289 289
290| Return Type | Description | 290| Tipe Return | Deskripsi |
291| --- | --- | 291| --- | --- |
292| function \| nil | The loaded function, or nil if the loading failed. | 292| function \| nil | Fungsi yang dimuat, atau nil jika pemuatan gagal. |
293| string \| nil | The error message, or nil if the loading succeeded. | 293| string \| nil | Pesan error, atau nil jika pemuatan berhasil. |
294 294
295### loadfile 295### loadfile
296 296
297**Type:** Function. 297**Tipe:** Function.
298 298
299**Description:** 299**Deskripsi:**
300 300
301Loads YueScript code from a file into a function. 301Memuat kode YueScript dari file menjadi fungsi.
302 302
303**Signature:** 303**Signature:**
304```lua 304```lua
@@ -307,178 +307,178 @@ loadfile: function(filename: string, config?: Config):
307 string | nil 307 string | nil
308``` 308```
309 309
310**Parameters:** 310**Parameter:**
311 311
312| Parameter | Type | Description | 312| Parameter | Tipe | Deskripsi |
313| --- | --- | --- | 313| --- | --- | --- |
314| filename | string | The file name. | 314| filename | string | Nama file. |
315| config | Config | [Optional] The compiler options. | 315| config | Config | [Opsional] Opsi kompiler. |
316 316
317**Returns:** 317**Return:**
318 318
319| Return Type | Description | 319| Tipe Return | Deskripsi |
320| --- | --- | 320| --- | --- |
321| function \| nil | The loaded function, or nil if the loading failed. | 321| function \| nil | Fungsi yang dimuat, atau nil jika pemuatan gagal. |
322| string \| nil | The error message, or nil if the loading succeeded. | 322| string \| nil | Pesan error, atau nil jika pemuatan berhasil. |
323 323
324### dofile 324### dofile
325 325
326**Type:** Function. 326**Tipe:** Function.
327 327
328**Description:** 328**Deskripsi:**
329 329
330Loads YueScript code from a file into a function and executes it. 330Memuat kode YueScript dari file menjadi fungsi dan mengeksekusinya.
331 331
332**Signature:** 332**Signature:**
333```lua 333```lua
334dofile: function(filename: string, env: table, config?: Config): any... 334dofile: function(filename: string, env: table, config?: Config): any...
335``` 335```
336 336
337**Parameters:** 337**Parameter:**
338 338
339| Parameter | Type | Description | 339| Parameter | Tipe | Deskripsi |
340| --- | --- | --- | 340| --- | --- | --- |
341| filename | string | The file name. | 341| filename | string | Nama file. |
342| env | table | The environment table. | 342| env | table | Tabel environment. |
343| config | Config | [Optional] The compiler options. | 343| config | Config | [Opsional] Opsi kompiler. |
344 344
345**Returns:** 345**Return:**
346 346
347| Return Type | Description | 347| Tipe Return | Deskripsi |
348| --- | --- | 348| --- | --- |
349| any... | The return values of the loaded function. | 349| any... | Nilai return dari fungsi yang dimuat. |
350 350
351### dofile 351### dofile
352 352
353**Type:** Function. 353**Tipe:** Function.
354 354
355**Description:** 355**Deskripsi:**
356 356
357Loads YueScript code from a file into a function and executes it. 357Memuat kode YueScript dari file menjadi fungsi dan mengeksekusinya.
358 358
359**Signature:** 359**Signature:**
360```lua 360```lua
361dofile: function(filename: string, config?: Config): any... 361dofile: function(filename: string, config?: Config): any...
362``` 362```
363 363
364**Parameters:** 364**Parameter:**
365 365
366| Parameter | Type | Description | 366| Parameter | Tipe | Deskripsi |
367| --- | --- | --- | 367| --- | --- | --- |
368| filename | string | The file name. | 368| filename | string | Nama file. |
369| config | Config | [Optional] The compiler options. | 369| config | Config | [Opsional] Opsi kompiler. |
370 370
371**Returns:** 371**Return:**
372 372
373| Return Type | Description | 373| Tipe Return | Deskripsi |
374| --- | --- | 374| --- | --- |
375| any... | The return values of the loaded function. | 375| any... | Nilai return dari fungsi yang dimuat. |
376 376
377### find_modulepath 377### find_modulepath
378 378
379**Type:** Function. 379**Tipe:** Function.
380 380
381**Description:** 381**Deskripsi:**
382 382
383Resolves the YueScript module name to the file path. 383Menguraikan nama modul YueScript menjadi path file.
384 384
385**Signature:** 385**Signature:**
386```lua 386```lua
387find_modulepath: function(name: string): string 387find_modulepath: function(name: string): string
388``` 388```
389 389
390**Parameters:** 390**Parameter:**
391 391
392| Parameter | Type | Description | 392| Parameter | Tipe | Deskripsi |
393| --- | --- | --- | 393| --- | --- | --- |
394| name | string | The module name. | 394| name | string | Nama modul. |
395 395
396**Returns:** 396**Return:**
397 397
398| Return Type | Description | 398| Tipe Return | Deskripsi |
399| --- | --- | 399| --- | --- |
400| string | The file path. | 400| string | Path file. |
401 401
402### pcall 402### pcall
403 403
404**Type:** Function. 404**Tipe:** Function.
405 405
406**Description:** 406**Deskripsi:**
407 407
408Calls a function in protected mode. 408Memanggil fungsi dalam mode terlindungi.
409Catches any errors and returns a status code and results or error object. 409Menangkap error apa pun dan mengembalikan kode status beserta hasil atau objek error.
410Rewrites the error line number to the original line number in the YueScript code when errors occur. 410Menulis ulang nomor baris error ke nomor baris asli di kode YueScript saat error terjadi.
411 411
412**Signature:** 412**Signature:**
413```lua 413```lua
414pcall: function(f: function, ...: any): boolean, any... 414pcall: function(f: function, ...: any): boolean, any...
415``` 415```
416 416
417**Parameters:** 417**Parameter:**
418 418
419| Parameter | Type | Description | 419| Parameter | Tipe | Deskripsi |
420| --- | --- | --- | 420| --- | --- | --- |
421| f | function | The function to call. | 421| f | function | Fungsi yang akan dipanggil. |
422| ... | any | Arguments to pass to the function. | 422| ... | any | Argumen yang diteruskan ke fungsi. |
423 423
424**Returns:** 424**Return:**
425 425
426| Return Type | Description | 426| Tipe Return | Deskripsi |
427| --- | --- | 427| --- | --- |
428| boolean, ... | Status code and function results or error object. | 428| boolean, ... | Kode status dan hasil fungsi atau objek error. |
429 429
430### require 430### require
431 431
432**Type:** Function. 432**Tipe:** Function.
433 433
434**Description:** 434**Deskripsi:**
435 435
436Loads a given module. Can be either a Lua module or a YueScript module. 436Memuat modul tertentu. Bisa berupa modul Lua atau modul YueScript.
437Rewrites the error line number to the original line number in the YueScript code if the module is a YueScript module and loading fails. 437Menulis ulang nomor baris error ke nomor baris asli di kode YueScript jika modul adalah modul YueScript dan pemuatan gagal.
438 438
439**Signature:** 439**Signature:**
440```lua 440```lua
441require: function(name: string): any... 441require: function(name: string): any...
442``` 442```
443 443
444**Parameters:** 444**Parameter:**
445 445
446| Parameter | Type | Description | 446| Parameter | Tipe | Deskripsi |
447| --- | --- | --- | 447| --- | --- | --- |
448| modname | string | The name of the module to load. | 448| modname | string | Nama modul yang akan dimuat. |
449 449
450**Returns:** 450**Return:**
451 451
452| Return Type | Description | 452| Tipe Return | Deskripsi |
453| --- | --- | 453| --- | --- |
454| any | The value stored at package.loaded[modname] if the module is already loaded.Otherwise, tries to find a loader and returns the final value of package.loaded[modname] and a loader data as a second result. | 454| any | Nilai yang disimpan di package.loaded[modname] jika modul sudah dimuat. Jika belum, mencoba mencari loader dan mengembalikan nilai akhir package.loaded[modname] serta data loader sebagai hasil kedua. |
455 455
456### p 456### p
457 457
458**Type:** Function. 458**Tipe:** Function.
459 459
460**Description:** 460**Deskripsi:**
461 461
462Inspects the structures of the passed values and prints string representations. 462Memeriksa struktur nilai yang diteruskan dan mencetak representasi string.
463 463
464**Signature:** 464**Signature:**
465```lua 465```lua
466p: function(...: any) 466p: function(...: any)
467``` 467```
468 468
469**Parameters:** 469**Parameter:**
470 470
471| Parameter | Type | Description | 471| Parameter | Tipe | Deskripsi |
472| --- | --- | --- | 472| --- | --- | --- |
473| ... | any | The values to inspect. | 473| ... | any | Nilai yang akan diperiksa. |
474 474
475### options 475### options
476 476
477**Type:** Field. 477**Tipe:** Field.
478 478
479**Description:** 479**Deskripsi:**
480 480
481The current compiler options. 481Opsi kompiler saat ini.
482 482
483**Signature:** 483**Signature:**
484```lua 484```lua
@@ -487,62 +487,62 @@ options: Config.Options
487 487
488### traceback 488### traceback
489 489
490**Type:** Function. 490**Tipe:** Function.
491 491
492**Description:** 492**Deskripsi:**
493 493
494The traceback function that rewrites the stack trace line numbers to the original line numbers in the YueScript code. 494Fungsi traceback yang menulis ulang nomor baris stack trace ke nomor baris asli di kode YueScript.
495 495
496**Signature:** 496**Signature:**
497```lua 497```lua
498traceback: function(message: string): string 498traceback: function(message: string): string
499``` 499```
500 500
501**Parameters:** 501**Parameter:**
502 502
503| Parameter | Type | Description | 503| Parameter | Tipe | Deskripsi |
504| --- | --- | --- | 504| --- | --- | --- |
505| message | string | The traceback message. | 505| message | string | Pesan traceback. |
506 506
507**Returns:** 507**Return:**
508 508
509| Return Type | Description | 509| Tipe Return | Deskripsi |
510| --- | --- | 510| --- | --- |
511| string | The rewritten traceback message. | 511| string | Pesan traceback yang telah ditulis ulang. |
512 512
513### is_ast 513### is_ast
514 514
515**Type:** Function. 515**Tipe:** Function.
516 516
517**Description:** 517**Deskripsi:**
518 518
519Checks whether the code matches the specified AST. 519Memeriksa apakah kode cocok dengan AST yang ditentukan.
520 520
521**Signature:** 521**Signature:**
522```lua 522```lua
523is_ast: function(astName: string, code: string): boolean 523is_ast: function(astName: string, code: string): boolean
524``` 524```
525 525
526**Parameters:** 526**Parameter:**
527 527
528| Parameter | Type | Description | 528| Parameter | Tipe | Deskripsi |
529| --- | --- | --- | 529| --- | --- | --- |
530| astName | string | The AST name. | 530| astName | string | Nama AST. |
531| code | string | The code. | 531| code | string | Kode. |
532 532
533**Returns:** 533**Return:**
534 534
535| Return Type | Description | 535| Tipe Return | Deskripsi |
536| --- | --- | 536| --- | --- |
537| boolean | Whether the code matches the AST. | 537| boolean | Apakah kode cocok dengan AST. |
538 538
539### AST 539### AST
540 540
541**Type:** Field. 541**Tipe:** Field.
542 542
543**Description:** 543**Deskripsi:**
544 544
545The AST type definition with name, row, column and sub nodes. 545Definisi tipe AST dengan nama, baris, kolom, dan sub-node.
546 546
547**Signature:** 547**Signature:**
548```lua 548```lua
@@ -551,11 +551,11 @@ type AST = {string, integer, integer, any}
551 551
552### to_ast 552### to_ast
553 553
554**Type:** Function. 554**Tipe:** Function.
555 555
556**Description:** 556**Deskripsi:**
557 557
558Converts the code to the AST. 558Mengonversi kode menjadi AST.
559 559
560**Signature:** 560**Signature:**
561```lua 561```lua
@@ -564,88 +564,88 @@ to_ast: function(code: string, flattenLevel?: number, astName?: string, reserveC
564 --[[error]] nil | string 564 --[[error]] nil | string
565``` 565```
566 566
567**Parameters:** 567**Parameter:**
568 568
569| Parameter | Type | Description | 569| Parameter | Tipe | Deskripsi |
570| --- | --- | --- | 570| --- | --- | --- |
571| code | string | The code. | 571| code | string | Kode. |
572| flattenLevel | integer | [Optional] The flatten level. Higher level means more flattening. Default is 0. Maximum is 2. | 572| flattenLevel | integer | [Opsional] Tingkat perataan. Semakin tinggi berarti semakin rata. Default 0. Maksimum 2. |
573| astName | string | [Optional] The AST name. Default is "File". | 573| astName | string | [Opsional] Nama AST. Default "File". |
574| reserveComment | boolean | [Optional] Whether to reserve the original comments. Default is false. | 574| reserveComment | boolean | [Opsional] Apakah akan mempertahankan komentar asli. Default false. |
575 575
576**Returns:** 576**Return:**
577 577
578| Return Type | Description | 578| Tipe Return | Deskripsi |
579| --- | --- | 579| --- | --- |
580| AST \| nil | The AST, or nil if the conversion failed. | 580| AST \| nil | AST, atau nil jika konversi gagal. |
581| string \| nil | The error message, or nil if the conversion succeeded. | 581| string \| nil | Pesan error, atau nil jika konversi berhasil. |
582 582
583### format 583### format
584 584
585**Type:** Function. 585**Tipe:** Function.
586 586
587**Description:** 587**Deskripsi:**
588 588
589Formats the YueScript code. 589Memformat kode YueScript.
590 590
591**Signature:** 591**Signature:**
592```lua 592```lua
593format: function(code: string, tabSize?: number, reserveComment?: boolean): string 593format: function(code: string, tabSize?: number, reserveComment?: boolean): string
594``` 594```
595 595
596**Parameters:** 596**Parameter:**
597 597
598| Parameter | Type | Description | 598| Parameter | Tipe | Deskripsi |
599| --- | --- | --- | 599| --- | --- | --- |
600| code | string | The code. | 600| code | string | Kode. |
601| tabSize | integer | [Optional] The tab size. Default is 4. | 601| tabSize | integer | [Opsional] Ukuran tab. Default 4. |
602| reserveComment | boolean | [Optional] Whether to reserve the original comments. Default is true. | 602| reserveComment | boolean | [Opsional] Apakah mempertahankan komentar asli. Default true. |
603 603
604**Returns:** 604**Return:**
605 605
606| Return Type | Description | 606| Tipe Return | Deskripsi |
607| --- | --- | 607| --- | --- |
608| string | The formatted code. | 608| string | Kode yang telah diformat. |
609 609
610### __call 610### __call
611 611
612**Type:** Metamethod. 612**Tipe:** Metamethod.
613 613
614**Description:** 614**Deskripsi:**
615 615
616Requires the YueScript module. 616Me-require modul YueScript.
617Rewrites the error line number to the original line number in the YueScript code when loading fails. 617Menulis ulang nomor baris error ke nomor baris asli di kode YueScript saat pemuatan gagal.
618 618
619**Signature:** 619**Signature:**
620```lua 620```lua
621metamethod __call: function(self: yue, module: string): any... 621metamethod __call: function(self: yue, module: string): any...
622``` 622```
623 623
624**Parameters:** 624**Parameter:**
625 625
626| Parameter | Type | Description | 626| Parameter | Tipe | Deskripsi |
627| --- | --- | --- | 627| --- | --- | --- |
628| module | string | The module name. | 628| module | string | Nama modul. |
629 629
630**Returns:** 630**Return:**
631 631
632| Return Type | Description | 632| Tipe Return | Deskripsi |
633| --- | --- | 633| --- | --- |
634| any | The module value. | 634| any | Nilai modul. |
635 635
636## Config 636## Config
637 637
638**Description:** 638**Deskripsi:**
639 639
640The compiler compile options. 640Opsi kompilasi kompiler.
641 641
642### lint_global 642### lint_global
643 643
644**Type:** Field. 644**Tipe:** Field.
645 645
646**Description:** 646**Deskripsi:**
647 647
648Whether the compiler should collect the global variables appearing in the code. 648Apakah kompiler harus mengumpulkan variabel global yang muncul dalam kode.
649 649
650**Signature:** 650**Signature:**
651```lua 651```lua
@@ -654,11 +654,11 @@ lint_global: boolean
654 654
655### implicit_return_root 655### implicit_return_root
656 656
657**Type:** Field. 657**Tipe:** Field.
658 658
659**Description:** 659**Deskripsi:**
660 660
661Whether the compiler should do an implicit return for the root code block. 661Apakah kompiler harus melakukan return implisit untuk blok kode root.
662 662
663**Signature:** 663**Signature:**
664```lua 664```lua
@@ -667,11 +667,11 @@ implicit_return_root: boolean
667 667
668### reserve_line_number 668### reserve_line_number
669 669
670**Type:** Field. 670**Tipe:** Field.
671 671
672**Description:** 672**Deskripsi:**
673 673
674Whether the compiler should reserve the original line number in the compiled code. 674Apakah kompiler harus mempertahankan nomor baris asli di kode hasil kompilasi.
675 675
676**Signature:** 676**Signature:**
677```lua 677```lua
@@ -680,11 +680,11 @@ reserve_line_number: boolean
680 680
681### reserve_comment 681### reserve_comment
682 682
683**Type:** Field. 683**Tipe:** Field.
684 684
685**Description:** 685**Deskripsi:**
686 686
687Whether the compiler should reserve the original comments in the compiled code. 687Apakah kompiler harus mempertahankan komentar asli di kode hasil kompilasi.
688 688
689**Signature:** 689**Signature:**
690```lua 690```lua
@@ -693,11 +693,11 @@ reserve_comment: boolean
693 693
694### space_over_tab 694### space_over_tab
695 695
696**Type:** Field. 696**Tipe:** Field.
697 697
698**Description:** 698**Deskripsi:**
699 699
700Whether the compiler should use the space character instead of the tab character in the compiled code. 700Apakah kompiler harus menggunakan karakter spasi alih-alih tab di kode hasil kompilasi.
701 701
702**Signature:** 702**Signature:**
703```lua 703```lua
@@ -706,11 +706,11 @@ space_over_tab: boolean
706 706
707### same_module 707### same_module
708 708
709**Type:** Field. 709**Tipe:** Field.
710 710
711**Description:** 711**Deskripsi:**
712 712
713Whether the compiler should treat the code to be compiled as the same currently being compiled module. For internal use only. 713Apakah kompiler harus memperlakukan kode yang akan dikompilasi sebagai modul yang sama dengan modul yang sedang dikompilasi. Untuk penggunaan internal saja.
714 714
715**Signature:** 715**Signature:**
716```lua 716```lua
@@ -719,11 +719,11 @@ same_module: boolean
719 719
720### line_offset 720### line_offset
721 721
722**Type:** Field. 722**Tipe:** Field.
723 723
724**Description:** 724**Deskripsi:**
725 725
726Whether the compiler error message should include the line number offset. For internal use only. 726Apakah pesan error kompiler harus menyertakan offset nomor baris. Untuk penggunaan internal saja.
727 727
728**Signature:** 728**Signature:**
729```lua 729```lua
@@ -732,11 +732,11 @@ line_offset: integer
732 732
733### yue.Config.LuaTarget 733### yue.Config.LuaTarget
734 734
735**Type:** Enumeration. 735**Tipe:** Enumeration.
736 736
737**Description:** 737**Deskripsi:**
738 738
739The target Lua version enumeration. 739Enumerasi versi Lua target.
740 740
741**Signature:** 741**Signature:**
742```lua 742```lua
@@ -751,11 +751,11 @@ end
751 751
752### options 752### options
753 753
754**Type:** Field. 754**Tipe:** Field.
755 755
756**Description:** 756**Deskripsi:**
757 757
758The extra options to be passed to the compilation function. 758Opsi tambahan untuk diteruskan ke fungsi kompilasi.
759 759
760**Signature:** 760**Signature:**
761```lua 761```lua
@@ -764,17 +764,17 @@ options: Options
764 764
765## Options 765## Options
766 766
767**Description:** 767**Deskripsi:**
768 768
769The extra compiler options definition. 769Definisi opsi kompiler tambahan.
770 770
771### target 771### target
772 772
773**Type:** Field. 773**Tipe:** Field.
774 774
775**Description:** 775**Deskripsi:**
776 776
777The target Lua version for the compilation. 777Versi Lua target untuk kompilasi.
778 778
779**Signature:** 779**Signature:**
780```lua 780```lua
@@ -783,11 +783,11 @@ target: LuaTarget
783 783
784### path 784### path
785 785
786**Type:** Field. 786**Tipe:** Field.
787 787
788**Description:** 788**Deskripsi:**
789 789
790The extra module search path. 790Path pencarian modul tambahan.
791 791
792**Signature:** 792**Signature:**
793```lua 793```lua
@@ -796,11 +796,11 @@ path: string
796 796
797### dump_locals 797### dump_locals
798 798
799**Type:** Field. 799**Tipe:** Field.
800 800
801**Description:** 801**Deskripsi:**
802 802
803Whether to dump the local variables in the traceback error message. Default is false. 803Apakah akan menampilkan variabel local dalam pesan error traceback. Default false.
804 804
805**Signature:** 805**Signature:**
806```lua 806```lua
@@ -809,11 +809,11 @@ dump_locals: boolean
809 809
810### simplified 810### simplified
811 811
812**Type:** Field. 812**Tipe:** Field.
813 813
814**Description:** 814**Deskripsi:**
815 815
816Whether to simplify the error message. Default is true. 816Apakah akan menyederhanakan pesan error. Default true.
817 817
818**Signature:** 818**Signature:**
819```lua 819```lua
diff --git a/doc/docs/id-id/index.md b/doc/docs/id-id/index.md
index 016b688..c8b5fab 100644
--- a/doc/docs/id-id/index.md
+++ b/doc/docs/id-id/index.md
@@ -2,22 +2,22 @@
2layout: home 2layout: home
3hero: 3hero:
4 name: YueScript 4 name: YueScript
5 tagline: A language that compiles to Lua 5 tagline: Bahasa yang dikompilasi ke Lua
6 image: 6 image:
7 src: /image/yuescript.svg 7 src: /image/yuescript.svg
8 alt: YueScript 8 alt: YueScript
9 actions: 9 actions:
10 - theme: brand 10 - theme: brand
11 text: Quick Start → 11 text: Mulai Cepat →
12 link: /doc/ 12 link: /doc/
13features: 13features:
14 - title: Familiar Lua workflows 14 - title: Alur kerja Lua yang familiar
15 details: Write concise syntax that compiles to readable Lua, with predictable output. 15 details: Tulis sintaks ringkas yang dikompilasi ke Lua yang mudah dibaca, dengan output yang dapat diprediksi.
16 - title: Modern language features 16 - title: Fitur bahasa modern
17 details: Pipe, pattern matching, slicing, and destructuring without giving up Lua interop. 17 details: Pipe, pattern matching, slicing, dan destrukturisasi tanpa mengorbankan interoperabilitas Lua.
18 - title: Rapid Iteration 18 - title: Iterasi Cepat
19 details: Any feedback is welcome to help accelerate the language development and evolution! 19 details: Setiap masukan sangat diterima untuk membantu mempercepat pengembangan dan evolusi bahasa!
20footer: 20footer:
21 message: MIT License. 21 message: Lisensi MIT.
22 copyright: Copyright © 2017-2026 Li Jin. All rights reserved. 22 copyright: Hak cipta © 2017-2026 Li Jin. Semua hak dilindungi.
23--- 23---
diff --git a/doc/docs/id-id/try/index.md b/doc/docs/id-id/try/index.md
index 85a903b..c31dc1c 100755
--- a/doc/docs/id-id/try/index.md
+++ b/doc/docs/id-id/try/index.md
@@ -4,9 +4,9 @@ prev: false
4next: false 4next: false
5--- 5---
6 6
7# YueScript Online Compiler 7# Kompiler Online YueScript
8--- 8---
9 9
10Try YueScript in the browser with WASM. 10Coba YueScript di browser dengan WASM.
11 11
12<YueCompiler /> 12<YueCompiler />