summaryrefslogtreecommitdiff
path: root/doc/docs/id-id/doc/reference/the-yuescript-library.md
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--doc/docs/id-id/doc/reference/the-yuescript-library.md554
1 files changed, 277 insertions, 277 deletions
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