diff options
| author | Dania Rifki <atomicnumberphi@gmail.com> | 2026-02-07 18:40:56 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2026-02-07 18:48:17 +0800 |
| commit | 8a5e2639d349402ad66d838ed45a124b53c35b7e (patch) | |
| tree | a33227e21ee599e22990e0beb258a536e0b72319 /doc/docs/id-id | |
| parent | 85436c1272be0f48a22e1d22badd1cc32d9f09cb (diff) | |
| download | yuescript-8a5e2639d349402ad66d838ed45a124b53c35b7e.tar.gz yuescript-8a5e2639d349402ad66d838ed45a124b53c35b7e.tar.bz2 yuescript-8a5e2639d349402ad66d838ed45a124b53c35b7e.zip | |
Format docs with prettier
Also adjust custom.css a little
Diffstat (limited to 'doc/docs/id-id')
30 files changed, 422 insertions, 190 deletions
diff --git a/doc/docs/id-id/doc/advanced/do.md b/doc/docs/id-id/doc/advanced/do.md index ebbd2e2..ac75531 100644 --- a/doc/docs/id-id/doc/advanced/do.md +++ b/doc/docs/id-id/doc/advanced/do.md | |||
| @@ -8,6 +8,7 @@ do | |||
| 8 | print var | 8 | print var |
| 9 | print var -- nil di sini | 9 | print var -- nil di sini |
| 10 | ``` | 10 | ``` |
| 11 | |||
| 11 | <YueDisplay> | 12 | <YueDisplay> |
| 12 | 13 | ||
| 13 | ```yue | 14 | ```yue |
| @@ -31,6 +32,7 @@ counter = do | |||
| 31 | print counter! | 32 | print counter! |
| 32 | print counter! | 33 | print counter! |
| 33 | ``` | 34 | ``` |
| 35 | |||
| 34 | <YueDisplay> | 36 | <YueDisplay> |
| 35 | 37 | ||
| 36 | ```yue | 38 | ```yue |
| @@ -53,6 +55,7 @@ tbl = { | |||
| 53 | 1234 | 55 | 1234 |
| 54 | } | 56 | } |
| 55 | ``` | 57 | ``` |
| 58 | |||
| 56 | <YueDisplay> | 59 | <YueDisplay> |
| 57 | 60 | ||
| 58 | ```yue | 61 | ```yue |
diff --git a/doc/docs/id-id/doc/advanced/line-decorators.md b/doc/docs/id-id/doc/advanced/line-decorators.md index e90e205..d968b1f 100644 --- a/doc/docs/id-id/doc/advanced/line-decorators.md +++ b/doc/docs/id-id/doc/advanced/line-decorators.md | |||
| @@ -5,6 +5,7 @@ Untuk kemudahan, loop for dan pernyataan if dapat diterapkan pada pernyataan tun | |||
| 5 | ```yuescript | 5 | ```yuescript |
| 6 | print "hello world" if name == "Rob" | 6 | print "hello world" if name == "Rob" |
| 7 | ``` | 7 | ``` |
| 8 | |||
| 8 | <YueDisplay> | 9 | <YueDisplay> |
| 9 | 10 | ||
| 10 | ```yue | 11 | ```yue |
| @@ -18,6 +19,7 @@ Dan dengan loop dasar: | |||
| 18 | ```yuescript | 19 | ```yuescript |
| 19 | print "item: ", item for item in *items | 20 | print "item: ", item for item in *items |
| 20 | ``` | 21 | ``` |
| 22 | |||
| 21 | <YueDisplay> | 23 | <YueDisplay> |
| 22 | 24 | ||
| 23 | ```yue | 25 | ```yue |
| @@ -33,6 +35,7 @@ game\update! while game\isRunning! | |||
| 33 | 35 | ||
| 34 | reader\parse_line! until reader\eof! | 36 | reader\parse_line! until reader\eof! |
| 35 | ``` | 37 | ``` |
| 38 | |||
| 36 | <YueDisplay> | 39 | <YueDisplay> |
| 37 | 40 | ||
| 38 | ```yue | 41 | ```yue |
diff --git a/doc/docs/id-id/doc/advanced/macro.md b/doc/docs/id-id/doc/advanced/macro.md index ce0bafa..d33ec5b 100644 --- a/doc/docs/id-id/doc/advanced/macro.md +++ b/doc/docs/id-id/doc/advanced/macro.md | |||
| @@ -32,6 +32,7 @@ macro and = (...) -> "#{ table.concat {...}, ' and ' }" | |||
| 32 | if $and f1!, f2!, f3! | 32 | if $and f1!, f2!, f3! |
| 33 | print "OK" | 33 | print "OK" |
| 34 | ``` | 34 | ``` |
| 35 | |||
| 35 | <YueDisplay> | 36 | <YueDisplay> |
| 36 | 37 | ||
| 37 | ```yue | 38 | ```yue |
| @@ -68,6 +69,7 @@ if $and f1!, f2!, f3! | |||
| 68 | ## Menyisipkan Kode Mentah | 69 | ## Menyisipkan Kode Mentah |
| 69 | 70 | ||
| 70 | Fungsi macro bisa mengembalikan string YueScript atau tabel konfigurasi yang berisi kode Lua. | 71 | Fungsi macro bisa mengembalikan string YueScript atau tabel konfigurasi yang berisi kode Lua. |
| 72 | |||
| 71 | ```yuescript | 73 | ```yuescript |
| 72 | macro yueFunc = (var) -> "local #{var} = ->" | 74 | macro yueFunc = (var) -> "local #{var} = ->" |
| 73 | $yueFunc funcA | 75 | $yueFunc funcA |
| @@ -93,6 +95,7 @@ if cond then | |||
| 93 | end | 95 | end |
| 94 | ]==] | 96 | ]==] |
| 95 | ``` | 97 | ``` |
| 98 | |||
| 96 | <YueDisplay> | 99 | <YueDisplay> |
| 97 | 100 | ||
| 98 | ```yue | 101 | ```yue |
| @@ -126,6 +129,7 @@ end | |||
| 126 | ## Export Macro | 129 | ## Export Macro |
| 127 | 130 | ||
| 128 | Fungsi 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. | 131 | Fungsi 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. |
| 132 | |||
| 129 | ```yuescript | 133 | ```yuescript |
| 130 | -- file: utils.yue | 134 | -- file: utils.yue |
| 131 | export macro map = (items, action) -> "[#{action} for _ in *#{items}]" | 135 | export macro map = (items, action) -> "[#{action} for _ in *#{items}]" |
| @@ -140,6 +144,7 @@ import "utils" as { | |||
| 140 | } | 144 | } |
| 141 | [1, 2, 3] |> $map(_ * 2) |> $filter(_ > 4) |> $each print _ | 145 | [1, 2, 3] |> $map(_ * 2) |> $filter(_ > 4) |> $each print _ |
| 142 | ``` | 146 | ``` |
| 147 | |||
| 143 | <YueDisplay> | 148 | <YueDisplay> |
| 144 | 149 | ||
| 145 | ```yue | 150 | ```yue |
| @@ -165,10 +170,12 @@ import "utils" as { | |||
| 165 | ## Macro Bawaan | 170 | ## Macro Bawaan |
| 166 | 171 | ||
| 167 | Ada beberapa macro bawaan tetapi Anda bisa menimpanya dengan mendeklarasikan macro dengan nama yang sama. | 172 | Ada beberapa macro bawaan tetapi Anda bisa menimpanya dengan mendeklarasikan macro dengan nama yang sama. |
| 173 | |||
| 168 | ```yuescript | 174 | ```yuescript |
| 169 | print $FILE -- mendapatkan string nama modul saat ini | 175 | print $FILE -- mendapatkan string nama modul saat ini |
| 170 | print $LINE -- mendapatkan angka 2 | 176 | print $LINE -- mendapatkan angka 2 |
| 171 | ``` | 177 | ``` |
| 178 | |||
| 172 | <YueDisplay> | 179 | <YueDisplay> |
| 173 | 180 | ||
| 174 | ```yue | 181 | ```yue |
| @@ -235,6 +242,7 @@ macro printNumAndStr = (num `Num, str `String) -> | | |||
| 235 | 242 | ||
| 236 | $printNumAndStr 123, "hello" | 243 | $printNumAndStr 123, "hello" |
| 237 | ``` | 244 | ``` |
| 245 | |||
| 238 | <YueDisplay> | 246 | <YueDisplay> |
| 239 | 247 | ||
| 240 | ```yue | 248 | ```yue |
| @@ -259,6 +267,7 @@ macro printNumAndStr = (num, str) -> | |||
| 259 | 267 | ||
| 260 | $printNumAndStr 123, "hello" | 268 | $printNumAndStr 123, "hello" |
| 261 | ``` | 269 | ``` |
| 270 | |||
| 262 | <YueDisplay> | 271 | <YueDisplay> |
| 263 | 272 | ||
| 264 | ```yue | 273 | ```yue |
diff --git a/doc/docs/id-id/doc/advanced/module.md b/doc/docs/id-id/doc/advanced/module.md index dd97a32..103e3f6 100644 --- a/doc/docs/id-id/doc/advanced/module.md +++ b/doc/docs/id-id/doc/advanced/module.md | |||
| @@ -28,6 +28,7 @@ do | |||
| 28 | import "lpeg" as :C, :Ct, :Cmt | 28 | import "lpeg" as :C, :Ct, :Cmt |
| 29 | import "export" as {one, two, Something:{umm:{ch}}} | 29 | import "export" as {one, two, Something:{umm:{ch}}} |
| 30 | ``` | 30 | ``` |
| 31 | |||
| 31 | <YueDisplay> | 32 | <YueDisplay> |
| 32 | 33 | ||
| 33 | ```yue | 34 | ```yue |
| @@ -67,6 +68,7 @@ do | |||
| 67 | import table.concat | 68 | import table.concat |
| 68 | print concat ["a", tostring 1] | 69 | print concat ["a", tostring 1] |
| 69 | ``` | 70 | ``` |
| 71 | |||
| 70 | <YueDisplay> | 72 | <YueDisplay> |
| 71 | 73 | ||
| 72 | ```yue | 74 | ```yue |
| @@ -98,6 +100,7 @@ do | |||
| 98 | print FLAG | 100 | print FLAG |
| 99 | FLAG = 123 | 101 | FLAG = 123 |
| 100 | ``` | 102 | ``` |
| 103 | |||
| 101 | <YueDisplay> | 104 | <YueDisplay> |
| 102 | 105 | ||
| 103 | ```yue | 106 | ```yue |
| @@ -140,6 +143,7 @@ export y = -> | |||
| 140 | export class Something | 143 | export class Something |
| 141 | umm: "cool" | 144 | umm: "cool" |
| 142 | ``` | 145 | ``` |
| 146 | |||
| 143 | <YueDisplay> | 147 | <YueDisplay> |
| 144 | 148 | ||
| 145 | ```yue | 149 | ```yue |
| @@ -166,6 +170,7 @@ Melakukan export bernama dengan destrukturisasi. | |||
| 166 | export :loadstring, to_lua: tolua = yue | 170 | export :loadstring, to_lua: tolua = yue |
| 167 | export {itemA: {:fieldA = 'default'}} = tb | 171 | export {itemA: {:fieldA = 'default'}} = tb |
| 168 | ``` | 172 | ``` |
| 173 | |||
| 169 | <YueDisplay> | 174 | <YueDisplay> |
| 170 | 175 | ||
| 171 | ```yue | 176 | ```yue |
| @@ -182,6 +187,7 @@ export.itemA = tb | |||
| 182 | export.<index> = items | 187 | export.<index> = items |
| 183 | export["a-b-c"] = 123 | 188 | export["a-b-c"] = 123 |
| 184 | ``` | 189 | ``` |
| 190 | |||
| 185 | <YueDisplay> | 191 | <YueDisplay> |
| 186 | 192 | ||
| 187 | ```yue | 193 | ```yue |
| @@ -208,6 +214,7 @@ else | |||
| 208 | export with tmp | 214 | export with tmp |
| 209 | j = 2000 | 215 | j = 2000 |
| 210 | ``` | 216 | ``` |
| 217 | |||
| 211 | <YueDisplay> | 218 | <YueDisplay> |
| 212 | 219 | ||
| 213 | ```yue | 220 | ```yue |
| @@ -234,6 +241,7 @@ export default -> | |||
| 234 | print "hello" | 241 | print "hello" |
| 235 | 123 | 242 | 123 |
| 236 | ``` | 243 | ``` |
| 244 | |||
| 237 | <YueDisplay> | 245 | <YueDisplay> |
| 238 | 246 | ||
| 239 | ```yue | 247 | ```yue |
diff --git a/doc/docs/id-id/doc/advanced/try.md b/doc/docs/id-id/doc/advanced/try.md index 6607451..4e63004 100644 --- a/doc/docs/id-id/doc/advanced/try.md +++ b/doc/docs/id-id/doc/advanced/try.md | |||
| @@ -29,6 +29,7 @@ catch err | |||
| 29 | print yue.traceback err | 29 | print yue.traceback err |
| 30 | print result | 30 | print result |
| 31 | ``` | 31 | ``` |
| 32 | |||
| 32 | <YueDisplay> | 33 | <YueDisplay> |
| 33 | 34 | ||
| 34 | ```yue | 35 | ```yue |
| @@ -82,6 +83,7 @@ catch e | |||
| 82 | print e | 83 | print e |
| 83 | e | 84 | e |
| 84 | ``` | 85 | ``` |
| 86 | |||
| 85 | <YueDisplay> | 87 | <YueDisplay> |
| 86 | 88 | ||
| 87 | ```yue | 89 | ```yue |
diff --git a/doc/docs/id-id/doc/assignment/assignment.md b/doc/docs/id-id/doc/assignment/assignment.md index d9fd45d..34e18fd 100644 --- a/doc/docs/id-id/doc/assignment/assignment.md +++ b/doc/docs/id-id/doc/assignment/assignment.md | |||
| @@ -7,6 +7,7 @@ hello = "world" | |||
| 7 | a, b, c = 1, 2, 3 | 7 | a, b, c = 1, 2, 3 |
| 8 | hello = 123 -- menggunakan variabel yang sudah ada | 8 | hello = 123 -- menggunakan variabel yang sudah ada |
| 9 | ``` | 9 | ``` |
| 10 | |||
| 10 | <YueDisplay> | 11 | <YueDisplay> |
| 11 | 12 | ||
| 12 | ```yue | 13 | ```yue |
| @@ -20,6 +21,7 @@ hello = 123 -- menggunakan variabel yang sudah ada | |||
| 20 | ## Pembaruan Nilai | 21 | ## Pembaruan Nilai |
| 21 | 22 | ||
| 22 | Anda dapat melakukan assignment pembaruan dengan banyak operator biner. | 23 | Anda dapat melakukan assignment pembaruan dengan banyak operator biner. |
| 24 | |||
| 23 | ```yuescript | 25 | ```yuescript |
| 24 | x = 1 | 26 | x = 1 |
| 25 | x += 1 | 27 | x += 1 |
| @@ -30,6 +32,7 @@ x %= 10 | |||
| 30 | s ..= "world" -- akan menambah local baru jika variabel local belum ada | 32 | s ..= "world" -- akan menambah local baru jika variabel local belum ada |
| 31 | arg or= "default value" | 33 | arg or= "default value" |
| 32 | ``` | 34 | ``` |
| 35 | |||
| 33 | <YueDisplay> | 36 | <YueDisplay> |
| 34 | 37 | ||
| 35 | ```yue | 38 | ```yue |
| @@ -48,10 +51,12 @@ arg or= "default value" | |||
| 48 | ## Assignment Berantai | 51 | ## Assignment Berantai |
| 49 | 52 | ||
| 50 | Anda bisa melakukan assignment berantai untuk menetapkan beberapa item ke nilai yang sama. | 53 | Anda bisa melakukan assignment berantai untuk menetapkan beberapa item ke nilai yang sama. |
| 54 | |||
| 51 | ```yuescript | 55 | ```yuescript |
| 52 | a = b = c = d = e = 0 | 56 | a = b = c = d = e = 0 |
| 53 | x = y = z = f! | 57 | x = y = z = f! |
| 54 | ``` | 58 | ``` |
| 59 | |||
| 55 | <YueDisplay> | 60 | <YueDisplay> |
| 56 | 61 | ||
| 57 | ```yue | 62 | ```yue |
| @@ -62,6 +67,7 @@ x = y = z = f! | |||
| 62 | </YueDisplay> | 67 | </YueDisplay> |
| 63 | 68 | ||
| 64 | ## Local Eksplisit | 69 | ## Local Eksplisit |
| 70 | |||
| 65 | ```yuescript | 71 | ```yuescript |
| 66 | do | 72 | do |
| 67 | local a = 1 | 73 | local a = 1 |
| @@ -78,6 +84,7 @@ do | |||
| 78 | a = 1 | 84 | a = 1 |
| 79 | B = 2 | 85 | B = 2 |
| 80 | ``` | 86 | ``` |
| 87 | |||
| 81 | <YueDisplay> | 88 | <YueDisplay> |
| 82 | 89 | ||
| 83 | ```yue | 90 | ```yue |
| @@ -100,6 +107,7 @@ do | |||
| 100 | </YueDisplay> | 107 | </YueDisplay> |
| 101 | 108 | ||
| 102 | ## Global Eksplisit | 109 | ## Global Eksplisit |
| 110 | |||
| 103 | ```yuescript | 111 | ```yuescript |
| 104 | do | 112 | do |
| 105 | global a = 1 | 113 | global a = 1 |
| @@ -116,6 +124,7 @@ do | |||
| 116 | B = 2 | 124 | B = 2 |
| 117 | local Temp = "a local value" | 125 | local Temp = "a local value" |
| 118 | ``` | 126 | ``` |
| 127 | |||
| 119 | <YueDisplay> | 128 | <YueDisplay> |
| 120 | 129 | ||
| 121 | ```yue | 130 | ```yue |
diff --git a/doc/docs/id-id/doc/assignment/destructuring-assignment.md b/doc/docs/id-id/doc/assignment/destructuring-assignment.md index ba591fd..b9956a8 100644 --- a/doc/docs/id-id/doc/assignment/destructuring-assignment.md +++ b/doc/docs/id-id/doc/assignment/destructuring-assignment.md | |||
| @@ -12,6 +12,7 @@ thing = [1, 2] | |||
| 12 | [a, b] = thing | 12 | [a, b] = thing |
| 13 | print a, b | 13 | print a, b |
| 14 | ``` | 14 | ``` |
| 15 | |||
| 15 | <YueDisplay> | 16 | <YueDisplay> |
| 16 | 17 | ||
| 17 | ```yue | 18 | ```yue |
| @@ -37,6 +38,7 @@ print hello, the_day | |||
| 37 | 38 | ||
| 38 | :day = obj -- OK untuk destrukturisasi sederhana tanpa kurung | 39 | :day = obj -- OK untuk destrukturisasi sederhana tanpa kurung |
| 39 | ``` | 40 | ``` |
| 41 | |||
| 40 | <YueDisplay> | 42 | <YueDisplay> |
| 41 | 43 | ||
| 42 | ```yue | 44 | ```yue |
| @@ -68,6 +70,7 @@ obj2 = { | |||
| 68 | {numbers: [first, second], properties: {color: color}} = obj2 | 70 | {numbers: [first, second], properties: {color: color}} = obj2 |
| 69 | print first, second, color | 71 | print first, second, color |
| 70 | ``` | 72 | ``` |
| 73 | |||
| 71 | <YueDisplay> | 74 | <YueDisplay> |
| 72 | 75 | ||
| 73 | ```yue | 76 | ```yue |
| @@ -95,6 +98,7 @@ Jika pernyataan destrukturisasi kompleks, Anda bisa memecahnya ke beberapa baris | |||
| 95 | } | 98 | } |
| 96 | } = obj2 | 99 | } = obj2 |
| 97 | ``` | 100 | ``` |
| 101 | |||
| 98 | <YueDisplay> | 102 | <YueDisplay> |
| 99 | 103 | ||
| 100 | ```yue | 104 | ```yue |
| @@ -113,6 +117,7 @@ Umumnya mengekstrak nilai dari tabel lalu menugaskannya ke variabel local dengan | |||
| 113 | ```yuescript | 117 | ```yuescript |
| 114 | {:concat, :insert} = table | 118 | {:concat, :insert} = table |
| 115 | ``` | 119 | ``` |
| 120 | |||
| 116 | <YueDisplay> | 121 | <YueDisplay> |
| 117 | 122 | ||
| 118 | ```yue | 123 | ```yue |
| @@ -126,6 +131,7 @@ Ini secara efektif sama seperti import, tetapi kita dapat mengganti nama field y | |||
| 126 | ```yuescript | 131 | ```yuescript |
| 127 | {:mix, :max, random: rand} = math | 132 | {:mix, :max, random: rand} = math |
| 128 | ``` | 133 | ``` |
| 134 | |||
| 129 | <YueDisplay> | 135 | <YueDisplay> |
| 130 | 136 | ||
| 131 | ```yue | 137 | ```yue |
| @@ -139,6 +145,7 @@ Anda bisa menulis nilai default saat destrukturisasi seperti: | |||
| 139 | ```yuescript | 145 | ```yuescript |
| 140 | {:name = "nameless", :job = "jobless"} = person | 146 | {:name = "nameless", :job = "jobless"} = person |
| 141 | ``` | 147 | ``` |
| 148 | |||
| 142 | <YueDisplay> | 149 | <YueDisplay> |
| 143 | 150 | ||
| 144 | ```yue | 151 | ```yue |
| @@ -152,6 +159,7 @@ Anda dapat menggunakan `_` sebagai placeholder saat destrukturisasi list: | |||
| 152 | ```yuescript | 159 | ```yuescript |
| 153 | [_, two, _, four] = items | 160 | [_, two, _, four] = items |
| 154 | ``` | 161 | ``` |
| 162 | |||
| 155 | <YueDisplay> | 163 | <YueDisplay> |
| 156 | 164 | ||
| 157 | ```yue | 165 | ```yue |
| @@ -171,6 +179,7 @@ print first -- prints: first | |||
| 171 | print bulk -- prints: {"second", "third", "fourth"} | 179 | print bulk -- prints: {"second", "third", "fourth"} |
| 172 | print last -- prints: last | 180 | print last -- prints: last |
| 173 | ``` | 181 | ``` |
| 182 | |||
| 174 | <YueDisplay> | 183 | <YueDisplay> |
| 175 | 184 | ||
| 176 | ```yue | 185 | ```yue |
| @@ -195,6 +204,7 @@ Operator spread dapat digunakan pada posisi berbeda untuk menangkap rentang yang | |||
| 195 | -- Tangkap semuanya kecuali elemen tengah | 204 | -- Tangkap semuanya kecuali elemen tengah |
| 196 | [first, ..._, last] = orders | 205 | [first, ..._, last] = orders |
| 197 | ``` | 206 | ``` |
| 207 | |||
| 198 | <YueDisplay> | 208 | <YueDisplay> |
| 199 | 209 | ||
| 200 | ```yue | 210 | ```yue |
| @@ -223,6 +233,7 @@ tuples = [ | |||
| 223 | for [left, right] in *tuples | 233 | for [left, right] in *tuples |
| 224 | print left, right | 234 | print left, right |
| 225 | ``` | 235 | ``` |
| 236 | |||
| 226 | <YueDisplay> | 237 | <YueDisplay> |
| 227 | 238 | ||
| 228 | ```yue | 239 | ```yue |
diff --git a/doc/docs/id-id/doc/assignment/if-assignment.md b/doc/docs/id-id/doc/assignment/if-assignment.md index b30d0d9..e212859 100644 --- a/doc/docs/id-id/doc/assignment/if-assignment.md +++ b/doc/docs/id-id/doc/assignment/if-assignment.md | |||
| @@ -6,6 +6,7 @@ Blok `if` dan `elseif` dapat menerima assignment sebagai ganti ekspresi kondisio | |||
| 6 | if user := database.find_user "moon" | 6 | if user := database.find_user "moon" |
| 7 | print user.name | 7 | print user.name |
| 8 | ``` | 8 | ``` |
| 9 | |||
| 9 | <YueDisplay> | 10 | <YueDisplay> |
| 10 | 11 | ||
| 11 | ```yue | 12 | ```yue |
| @@ -23,6 +24,7 @@ elseif world := os.getenv "world" | |||
| 23 | else | 24 | else |
| 24 | print "nothing :(" | 25 | print "nothing :(" |
| 25 | ``` | 26 | ``` |
| 27 | |||
| 26 | <YueDisplay> | 28 | <YueDisplay> |
| 27 | 29 | ||
| 28 | ```yue | 30 | ```yue |
| @@ -37,11 +39,13 @@ else | |||
| 37 | </YueDisplay> | 39 | </YueDisplay> |
| 38 | 40 | ||
| 39 | Assignment if dengan beberapa nilai return. Hanya nilai pertama yang dicek, nilai lainnya tetap berada dalam scope. | 41 | Assignment if dengan beberapa nilai return. Hanya nilai pertama yang dicek, nilai lainnya tetap berada dalam scope. |
| 42 | |||
| 40 | ```yuescript | 43 | ```yuescript |
| 41 | if success, result := pcall -> "get result without problems" | 44 | if success, result := pcall -> "get result without problems" |
| 42 | print result -- variabel result berada dalam scope | 45 | print result -- variabel result berada dalam scope |
| 43 | print "OK" | 46 | print "OK" |
| 44 | ``` | 47 | ``` |
| 48 | |||
| 45 | <YueDisplay> | 49 | <YueDisplay> |
| 46 | 50 | ||
| 47 | ```yue | 51 | ```yue |
| @@ -61,6 +65,7 @@ while byte := stream\read_one! | |||
| 61 | -- lakukan sesuatu dengan byte | 65 | -- lakukan sesuatu dengan byte |
| 62 | print byte | 66 | print byte |
| 63 | ``` | 67 | ``` |
| 68 | |||
| 64 | <YueDisplay> | 69 | <YueDisplay> |
| 65 | 70 | ||
| 66 | ```yue | 71 | ```yue |
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 6953138..6e47f0c 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 | |||
| @@ -17,6 +17,7 @@ my_func! | |||
| 17 | 17 | ||
| 18 | print i -- akan mencetak 0 | 18 | print i -- akan mencetak 0 |
| 19 | ``` | 19 | ``` |
| 20 | |||
| 20 | <YueDisplay> | 21 | <YueDisplay> |
| 21 | 22 | ||
| 22 | ```yue | 23 | ```yue |
| @@ -52,6 +53,7 @@ my_func = (using nil) -> | |||
| 52 | my_func! | 53 | my_func! |
| 53 | print i -- mencetak 100, i tidak terpengaruh | 54 | print i -- mencetak 100, i tidak terpengaruh |
| 54 | ``` | 55 | ``` |
| 56 | |||
| 55 | <YueDisplay> | 57 | <YueDisplay> |
| 56 | 58 | ||
| 57 | ```yue | 59 | ```yue |
| @@ -80,6 +82,7 @@ my_func = (add using k, i) -> | |||
| 80 | my_func(22) | 82 | my_func(22) |
| 81 | print i, k -- ini telah diperbarui | 83 | print i, k -- ini telah diperbarui |
| 82 | ``` | 84 | ``` |
| 85 | |||
| 83 | <YueDisplay> | 86 | <YueDisplay> |
| 84 | 87 | ||
| 85 | ```yue | 88 | ```yue |
diff --git a/doc/docs/id-id/doc/assignment/varargs-assignment.md b/doc/docs/id-id/doc/assignment/varargs-assignment.md index f24652f..9c5c8a3 100644 --- a/doc/docs/id-id/doc/assignment/varargs-assignment.md +++ b/doc/docs/id-id/doc/assignment/varargs-assignment.md | |||
| @@ -10,6 +10,7 @@ count = select '#', ... | |||
| 10 | first = select 1, ... | 10 | first = select 1, ... |
| 11 | print ok, count, first | 11 | print ok, count, first |
| 12 | ``` | 12 | ``` |
| 13 | |||
| 13 | <YueDisplay> | 14 | <YueDisplay> |
| 14 | 15 | ||
| 15 | ```yue | 16 | ```yue |
diff --git a/doc/docs/id-id/doc/control-flow/conditionals.md b/doc/docs/id-id/doc/control-flow/conditionals.md index 4f08b16..861eae6 100644 --- a/doc/docs/id-id/doc/control-flow/conditionals.md +++ b/doc/docs/id-id/doc/control-flow/conditionals.md | |||
| @@ -7,6 +7,7 @@ if have_coins | |||
| 7 | else | 7 | else |
| 8 | print "Tidak ada koin" | 8 | print "Tidak ada koin" |
| 9 | ``` | 9 | ``` |
| 10 | |||
| 10 | <YueDisplay> | 11 | <YueDisplay> |
| 11 | 12 | ||
| 12 | ```yue | 13 | ```yue |
| @@ -25,6 +26,7 @@ Sintaks pendek untuk pernyataan tunggal juga bisa digunakan: | |||
| 25 | have_coins = false | 26 | have_coins = false |
| 26 | if have_coins then print "Dapat koin" else print "Tidak ada koin" | 27 | if have_coins then print "Dapat koin" else print "Tidak ada koin" |
| 27 | ``` | 28 | ``` |
| 29 | |||
| 28 | <YueDisplay> | 30 | <YueDisplay> |
| 29 | 31 | ||
| 30 | ```yue | 32 | ```yue |
| @@ -40,6 +42,7 @@ Karena pernyataan if dapat digunakan sebagai ekspresi, ini juga bisa ditulis seb | |||
| 40 | have_coins = false | 42 | have_coins = false |
| 41 | print if have_coins then "Dapat koin" else "Tidak ada koin" | 43 | print if have_coins then "Dapat koin" else "Tidak ada koin" |
| 42 | ``` | 44 | ``` |
| 45 | |||
| 43 | <YueDisplay> | 46 | <YueDisplay> |
| 44 | 47 | ||
| 45 | ```yue | 48 | ```yue |
| @@ -65,6 +68,7 @@ else | |||
| 65 | 68 | ||
| 66 | print message -- prints: Saya sangat tinggi | 69 | print message -- prints: Saya sangat tinggi |
| 67 | ``` | 70 | ``` |
| 71 | |||
| 68 | <YueDisplay> | 72 | <YueDisplay> |
| 69 | 73 | ||
| 70 | ```yue | 74 | ```yue |
| @@ -90,6 +94,7 @@ Kebalikan dari if adalah unless: | |||
| 90 | unless os.date("%A") == "Monday" | 94 | unless os.date("%A") == "Monday" |
| 91 | print "hari ini bukan Senin!" | 95 | print "hari ini bukan Senin!" |
| 92 | ``` | 96 | ``` |
| 97 | |||
| 93 | <YueDisplay> | 98 | <YueDisplay> |
| 94 | 99 | ||
| 95 | ```yue | 100 | ```yue |
| @@ -102,6 +107,7 @@ unless os.date("%A") == "Monday" | |||
| 102 | ```yuescript | 107 | ```yuescript |
| 103 | print "Kamu beruntung!" unless math.random! > 0.1 | 108 | print "Kamu beruntung!" unless math.random! > 0.1 |
| 104 | ``` | 109 | ``` |
| 110 | |||
| 105 | <YueDisplay> | 111 | <YueDisplay> |
| 106 | 112 | ||
| 107 | ```yue | 113 | ```yue |
| @@ -123,6 +129,7 @@ if a in [1, 3, 5, 7] | |||
| 123 | if a in list | 129 | if a in list |
| 124 | print "memeriksa apakah `a` ada di dalam daftar" | 130 | print "memeriksa apakah `a` ada di dalam daftar" |
| 125 | ``` | 131 | ``` |
| 132 | |||
| 126 | <YueDisplay> | 133 | <YueDisplay> |
| 127 | 134 | ||
| 128 | ```yue | 135 | ```yue |
diff --git a/doc/docs/id-id/doc/control-flow/continue.md b/doc/docs/id-id/doc/control-flow/continue.md index 3d7a68c..798a44b 100644 --- a/doc/docs/id-id/doc/control-flow/continue.md +++ b/doc/docs/id-id/doc/control-flow/continue.md | |||
| @@ -9,6 +9,7 @@ while i < 10 | |||
| 9 | continue if i % 2 == 0 | 9 | continue if i % 2 == 0 |
| 10 | print i | 10 | print i |
| 11 | ``` | 11 | ``` |
| 12 | |||
| 12 | <YueDisplay> | 13 | <YueDisplay> |
| 13 | 14 | ||
| 14 | ```yue | 15 | ```yue |
| @@ -29,6 +30,7 @@ odds = for x in *my_numbers | |||
| 29 | continue if x % 2 == 1 | 30 | continue if x % 2 == 1 |
| 30 | x | 31 | x |
| 31 | ``` | 32 | ``` |
| 33 | |||
| 32 | <YueDisplay> | 34 | <YueDisplay> |
| 33 | 35 | ||
| 34 | ```yue | 36 | ```yue |
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 91ba22e..65386f7 100644 --- a/doc/docs/id-id/doc/control-flow/for-loop.md +++ b/doc/docs/id-id/doc/control-flow/for-loop.md | |||
| @@ -12,6 +12,7 @@ for k = 1, 15, 2 -- an optional step provided | |||
| 12 | for key, value in pairs object | 12 | for key, value in pairs object |
| 13 | print key, value | 13 | print key, value |
| 14 | ``` | 14 | ``` |
| 15 | |||
| 15 | <YueDisplay> | 16 | <YueDisplay> |
| 16 | 17 | ||
| 17 | ```yue | 18 | ```yue |
| @@ -33,6 +34,7 @@ Operator slicing dan **\*** dapat digunakan, seperti pada comprehension: | |||
| 33 | for item in *items[2, 4] | 34 | for item in *items[2, 4] |
| 34 | print item | 35 | print item |
| 35 | ``` | 36 | ``` |
| 37 | |||
| 36 | <YueDisplay> | 38 | <YueDisplay> |
| 37 | 39 | ||
| 38 | ```yue | 40 | ```yue |
| @@ -49,6 +51,7 @@ for item in *items do print item | |||
| 49 | 51 | ||
| 50 | for j = 1, 10, 3 do print j | 52 | for j = 1, 10, 3 do print j |
| 51 | ``` | 53 | ``` |
| 54 | |||
| 52 | <YueDisplay> | 55 | <YueDisplay> |
| 53 | 56 | ||
| 54 | ```yue | 57 | ```yue |
| @@ -70,6 +73,7 @@ doubled_evens = for i = 1, 20 | |||
| 70 | else | 73 | else |
| 71 | i | 74 | i |
| 72 | ``` | 75 | ``` |
| 76 | |||
| 73 | <YueDisplay> | 77 | <YueDisplay> |
| 74 | 78 | ||
| 75 | ```yue | 79 | ```yue |
| @@ -90,6 +94,7 @@ Contohnya, untuk menemukan angka pertama yang lebih besar dari 10: | |||
| 90 | first_large = for n in *numbers | 94 | first_large = for n in *numbers |
| 91 | break n if n > 10 | 95 | break n if n > 10 |
| 92 | ``` | 96 | ``` |
| 97 | |||
| 93 | <YueDisplay> | 98 | <YueDisplay> |
| 94 | 99 | ||
| 95 | ```yue | 100 | ```yue |
| @@ -112,6 +117,7 @@ func_b = -> return for i = 1, 10 do i | |||
| 112 | print func_a! -- prints nil | 117 | print func_a! -- prints nil |
| 113 | print func_b! -- prints table object | 118 | print func_b! -- prints table object |
| 114 | ``` | 119 | ``` |
| 120 | |||
| 115 | <YueDisplay> | 121 | <YueDisplay> |
| 116 | 122 | ||
| 117 | ```yue | 123 | ```yue |
diff --git a/doc/docs/id-id/doc/control-flow/switch.md b/doc/docs/id-id/doc/control-flow/switch.md index ced4748..1b7b86e 100644 --- a/doc/docs/id-id/doc/control-flow/switch.md +++ b/doc/docs/id-id/doc/control-flow/switch.md | |||
| @@ -11,6 +11,7 @@ switch name := "Dan" | |||
| 11 | else | 11 | else |
| 12 | print "I don't know about you with name #{name}" | 12 | print "I don't know about you with name #{name}" |
| 13 | ``` | 13 | ``` |
| 14 | |||
| 14 | <YueDisplay> | 15 | <YueDisplay> |
| 15 | 16 | ||
| 16 | ```yue | 17 | ```yue |
| @@ -39,6 +40,7 @@ next_number = switch b | |||
| 39 | else | 40 | else |
| 40 | error "can't count that high!" | 41 | error "can't count that high!" |
| 41 | ``` | 42 | ``` |
| 43 | |||
| 42 | <YueDisplay> | 44 | <YueDisplay> |
| 43 | 45 | ||
| 44 | ```yue | 46 | ```yue |
| @@ -62,6 +64,7 @@ msg = switch math.random(1, 5) | |||
| 62 | when 2 then "you are almost lucky" | 64 | when 2 then "you are almost lucky" |
| 63 | else "not so lucky" | 65 | else "not so lucky" |
| 64 | ``` | 66 | ``` |
| 67 | |||
| 65 | <YueDisplay> | 68 | <YueDisplay> |
| 66 | 69 | ||
| 67 | ```yue | 70 | ```yue |
| @@ -87,6 +90,7 @@ switch math.random(1, 5) when 1 | |||
| 87 | else | 90 | else |
| 88 | print "not so lucky" | 91 | print "not so lucky" |
| 89 | ``` | 92 | ``` |
| 93 | |||
| 90 | <YueDisplay> | 94 | <YueDisplay> |
| 91 | 95 | ||
| 92 | ```yue | 96 | ```yue |
| @@ -124,6 +128,7 @@ for item in *items | |||
| 124 | when :width, :height | 128 | when :width, :height |
| 125 | print "size #{width}, #{height}" | 129 | print "size #{width}, #{height}" |
| 126 | ``` | 130 | ``` |
| 131 | |||
| 127 | <YueDisplay> | 132 | <YueDisplay> |
| 128 | 133 | ||
| 129 | ```yue | 134 | ```yue |
| @@ -154,6 +159,7 @@ switch item | |||
| 154 | when {pos: {:x = 50, :y = 200}} | 159 | when {pos: {:x = 50, :y = 200}} |
| 155 | print "Vec2 #{x}, #{y}" -- table destructuring will still pass | 160 | print "Vec2 #{x}, #{y}" -- table destructuring will still pass |
| 156 | ``` | 161 | ``` |
| 162 | |||
| 157 | <YueDisplay> | 163 | <YueDisplay> |
| 158 | 164 | ||
| 159 | ```yue | 165 | ```yue |
| @@ -181,6 +187,7 @@ switch tb | |||
| 181 | when [1, 2, b = 3] -- b has a default value | 187 | when [1, 2, b = 3] -- b has a default value |
| 182 | print "1, 2, #{b}" | 188 | print "1, 2, #{b}" |
| 183 | ``` | 189 | ``` |
| 190 | |||
| 184 | <YueDisplay> | 191 | <YueDisplay> |
| 185 | 192 | ||
| 186 | ```yue | 193 | ```yue |
| @@ -206,6 +213,7 @@ switch tb | |||
| 206 | else | 213 | else |
| 207 | print "invalid" | 214 | print "invalid" |
| 208 | ``` | 215 | ``` |
| 216 | |||
| 209 | <YueDisplay> | 217 | <YueDisplay> |
| 210 | 218 | ||
| 211 | ```yue | 219 | ```yue |
| @@ -231,6 +239,7 @@ switch tb | |||
| 231 | else | 239 | else |
| 232 | print "invalid" | 240 | print "invalid" |
| 233 | ``` | 241 | ``` |
| 242 | |||
| 234 | <YueDisplay> | 243 | <YueDisplay> |
| 235 | 244 | ||
| 236 | ```yue | 245 | ```yue |
| @@ -257,6 +266,7 @@ switch tb | |||
| 257 | ] | 266 | ] |
| 258 | print "matched", fourth | 267 | print "matched", fourth |
| 259 | ``` | 268 | ``` |
| 269 | |||
| 260 | <YueDisplay> | 270 | <YueDisplay> |
| 261 | 271 | ||
| 262 | ```yue | 272 | ```yue |
| @@ -282,6 +292,7 @@ switch segments | |||
| 282 | print "Resource:", resource -- prints: "logs" | 292 | print "Resource:", resource -- prints: "logs" |
| 283 | print "Action:", action -- prints: "view" | 293 | print "Action:", action -- prints: "view" |
| 284 | ``` | 294 | ``` |
| 295 | |||
| 285 | <YueDisplay> | 296 | <YueDisplay> |
| 286 | 297 | ||
| 287 | ```yue | 298 | ```yue |
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 cd93c91..3e302cc 100644 --- a/doc/docs/id-id/doc/control-flow/while-loop.md +++ b/doc/docs/id-id/doc/control-flow/while-loop.md | |||
| @@ -10,6 +10,7 @@ while i > 0 | |||
| 10 | 10 | ||
| 11 | while running == true do my_function! | 11 | while running == true do my_function! |
| 12 | ``` | 12 | ``` |
| 13 | |||
| 13 | <YueDisplay> | 14 | <YueDisplay> |
| 14 | 15 | ||
| 15 | ```yue | 16 | ```yue |
| @@ -31,6 +32,7 @@ until i == 0 | |||
| 31 | 32 | ||
| 32 | until running == false do my_function! | 33 | until running == false do my_function! |
| 33 | ``` | 34 | ``` |
| 35 | |||
| 34 | <YueDisplay> | 36 | <YueDisplay> |
| 35 | 37 | ||
| 36 | ```yue | 38 | ```yue |
| @@ -56,6 +58,7 @@ repeat | |||
| 56 | i -= 1 | 58 | i -= 1 |
| 57 | until i == 0 | 59 | until i == 0 |
| 58 | ``` | 60 | ``` |
| 61 | |||
| 59 | <YueDisplay> | 62 | <YueDisplay> |
| 60 | 63 | ||
| 61 | ```yue | 64 | ```yue |
diff --git a/doc/docs/id-id/doc/data-structures/comprehensions.md b/doc/docs/id-id/doc/data-structures/comprehensions.md index 3a2a9ff..c5a8f7b 100644 --- a/doc/docs/id-id/doc/data-structures/comprehensions.md +++ b/doc/docs/id-id/doc/data-structures/comprehensions.md | |||
| @@ -10,6 +10,7 @@ Berikut membuat salinan tabel `items` tetapi semua nilainya digandakan. | |||
| 10 | items = [ 1, 2, 3, 4 ] | 10 | items = [ 1, 2, 3, 4 ] |
| 11 | doubled = [item * 2 for i, item in ipairs items] | 11 | doubled = [item * 2 for i, item in ipairs items] |
| 12 | ``` | 12 | ``` |
| 13 | |||
| 13 | <YueDisplay> | 14 | <YueDisplay> |
| 14 | 15 | ||
| 15 | ```yue | 16 | ```yue |
| @@ -24,6 +25,7 @@ Item yang disertakan dalam tabel baru bisa dibatasi dengan klausa `when`: | |||
| 24 | ```yuescript | 25 | ```yuescript |
| 25 | slice = [item for i, item in ipairs items when i > 1 and i < 3] | 26 | slice = [item for i, item in ipairs items when i > 1 and i < 3] |
| 26 | ``` | 27 | ``` |
| 28 | |||
| 27 | <YueDisplay> | 29 | <YueDisplay> |
| 28 | 30 | ||
| 29 | ```yue | 31 | ```yue |
| @@ -37,6 +39,7 @@ Karena umum untuk mengiterasi nilai dari tabel berindeks numerik, operator **\** | |||
| 37 | ```yuescript | 39 | ```yuescript |
| 38 | doubled = [item * 2 for item in *items] | 40 | doubled = [item * 2 for item in *items] |
| 39 | ``` | 41 | ``` |
| 42 | |||
| 40 | <YueDisplay> | 43 | <YueDisplay> |
| 41 | 44 | ||
| 42 | ```yue | 45 | ```yue |
| @@ -55,6 +58,7 @@ data = | |||
| 55 | flat = [...v for k,v in pairs data] | 58 | flat = [...v for k,v in pairs data] |
| 56 | -- flat sekarang [1, 2, 3, 4, 5, 6] | 59 | -- flat sekarang [1, 2, 3, 4, 5, 6] |
| 57 | ``` | 60 | ``` |
| 61 | |||
| 58 | <YueDisplay> | 62 | <YueDisplay> |
| 59 | 63 | ||
| 60 | ```yue | 64 | ```yue |
| @@ -79,6 +83,7 @@ y_coords = [9, 2, 3] | |||
| 79 | points = [ [x, y] for x in *x_coords \ | 83 | points = [ [x, y] for x in *x_coords \ |
| 80 | for y in *y_coords] | 84 | for y in *y_coords] |
| 81 | ``` | 85 | ``` |
| 86 | |||
| 82 | <YueDisplay> | 87 | <YueDisplay> |
| 83 | 88 | ||
| 84 | ```yue | 89 | ```yue |
| @@ -96,6 +101,7 @@ Perulangan for numerik juga bisa digunakan dalam komprehensi: | |||
| 96 | ```yuescript | 101 | ```yuescript |
| 97 | evens = [i for i = 1, 100 when i % 2 == 0] | 102 | evens = [i for i = 1, 100 when i % 2 == 0] |
| 98 | ``` | 103 | ``` |
| 104 | |||
| 99 | <YueDisplay> | 105 | <YueDisplay> |
| 100 | 106 | ||
| 101 | ```yue | 107 | ```yue |
| @@ -119,6 +125,7 @@ thing = { | |||
| 119 | 125 | ||
| 120 | thing_copy = {k, v for k, v in pairs thing} | 126 | thing_copy = {k, v for k, v in pairs thing} |
| 121 | ``` | 127 | ``` |
| 128 | |||
| 122 | <YueDisplay> | 129 | <YueDisplay> |
| 123 | 130 | ||
| 124 | ```yue | 131 | ```yue |
| @@ -136,6 +143,7 @@ thing_copy = {k, v for k, v in pairs thing} | |||
| 136 | ```yuescript | 143 | ```yuescript |
| 137 | no_color = {k, v for k, v in pairs thing when k != "color"} | 144 | no_color = {k, v for k, v in pairs thing when k != "color"} |
| 138 | ``` | 145 | ``` |
| 146 | |||
| 139 | <YueDisplay> | 147 | <YueDisplay> |
| 140 | 148 | ||
| 141 | ```yue | 149 | ```yue |
| @@ -150,6 +158,7 @@ Operator **\*** juga didukung. Di sini kita membuat tabel lookup akar kuadrat un | |||
| 150 | numbers = [1, 2, 3, 4] | 158 | numbers = [1, 2, 3, 4] |
| 151 | sqrts = {i, math.sqrt i for i in *numbers} | 159 | sqrts = {i, math.sqrt i for i in *numbers} |
| 152 | ``` | 160 | ``` |
| 161 | |||
| 153 | <YueDisplay> | 162 | <YueDisplay> |
| 154 | 163 | ||
| 155 | ```yue | 164 | ```yue |
| @@ -167,6 +176,7 @@ Dalam contoh ini kita mengonversi array pasangan menjadi tabel di mana item pert | |||
| 167 | tuples = [ ["hello", "world"], ["foo", "bar"]] | 176 | tuples = [ ["hello", "world"], ["foo", "bar"]] |
| 168 | tbl = {unpack tuple for tuple in *tuples} | 177 | tbl = {unpack tuple for tuple in *tuples} |
| 169 | ``` | 178 | ``` |
| 179 | |||
| 170 | <YueDisplay> | 180 | <YueDisplay> |
| 171 | 181 | ||
| 172 | ```yue | 182 | ```yue |
| @@ -185,6 +195,7 @@ Di sini kita bisa menetapkan batas minimum dan maksimum, mengambil semua item de | |||
| 185 | ```yuescript | 195 | ```yuescript |
| 186 | slice = [item for item in *items[1, 5]] | 196 | slice = [item for item in *items[1, 5]] |
| 187 | ``` | 197 | ``` |
| 198 | |||
| 188 | <YueDisplay> | 199 | <YueDisplay> |
| 189 | 200 | ||
| 190 | ```yue | 201 | ```yue |
| @@ -198,6 +209,7 @@ Salah satu argumen slice boleh dikosongkan untuk menggunakan default yang masuk | |||
| 198 | ```yuescript | 209 | ```yuescript |
| 199 | slice = [item for item in *items[2,]] | 210 | slice = [item for item in *items[2,]] |
| 200 | ``` | 211 | ``` |
| 212 | |||
| 201 | <YueDisplay> | 213 | <YueDisplay> |
| 202 | 214 | ||
| 203 | ```yue | 215 | ```yue |
| @@ -211,6 +223,7 @@ Jika batas minimum dikosongkan, defaultnya adalah 1. Di sini kita hanya memberik | |||
| 211 | ```yuescript | 223 | ```yuescript |
| 212 | slice = [item for item in *items[,,2]] | 224 | slice = [item for item in *items[,,2]] |
| 213 | ``` | 225 | ``` |
| 226 | |||
| 214 | <YueDisplay> | 227 | <YueDisplay> |
| 215 | 228 | ||
| 216 | ```yue | 229 | ```yue |
| @@ -225,6 +238,7 @@ Batas minimum dan maksimum bisa bernilai negatif, yang berarti batas dihitung da | |||
| 225 | -- ambil 4 item terakhir | 238 | -- ambil 4 item terakhir |
| 226 | slice = [item for item in *items[-4,-1]] | 239 | slice = [item for item in *items[-4,-1]] |
| 227 | ``` | 240 | ``` |
| 241 | |||
| 228 | <YueDisplay> | 242 | <YueDisplay> |
| 229 | 243 | ||
| 230 | ```yue | 244 | ```yue |
| @@ -239,6 +253,7 @@ Ukuran langkah juga bisa negatif, yang berarti item diambil dalam urutan terbali | |||
| 239 | ```yuescript | 253 | ```yuescript |
| 240 | reverse_slice = [item for item in *items[-1,1,-1]] | 254 | reverse_slice = [item for item in *items[-1,1,-1]] |
| 241 | ``` | 255 | ``` |
| 256 | |||
| 242 | <YueDisplay> | 257 | <YueDisplay> |
| 243 | 258 | ||
| 244 | ```yue | 259 | ```yue |
| @@ -258,6 +273,7 @@ sub_list = items[2, 4] | |||
| 258 | -- ambil 4 item terakhir | 273 | -- ambil 4 item terakhir |
| 259 | last_four_items = items[-4, -1] | 274 | last_four_items = items[-4, -1] |
| 260 | ``` | 275 | ``` |
| 276 | |||
| 261 | <YueDisplay> | 277 | <YueDisplay> |
| 262 | 278 | ||
| 263 | ```yue | 279 | ```yue |
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 df32f1c..c190f00 100644 --- a/doc/docs/id-id/doc/data-structures/table-literals.md +++ b/doc/docs/id-id/doc/data-structures/table-literals.md | |||
| @@ -5,6 +5,7 @@ Seperti di Lua, tabel dibatasi dengan kurung kurawal. | |||
| 5 | ```yuescript | 5 | ```yuescript |
| 6 | some_values = [1, 2, 3, 4] | 6 | some_values = [1, 2, 3, 4] |
| 7 | ``` | 7 | ``` |
| 8 | |||
| 8 | <YueDisplay> | 9 | <YueDisplay> |
| 9 | 10 | ||
| 10 | ```yue | 11 | ```yue |
| @@ -22,6 +23,7 @@ some_values = { | |||
| 22 | ["favorite food"]: "rice" | 23 | ["favorite food"]: "rice" |
| 23 | } | 24 | } |
| 24 | ``` | 25 | ``` |
| 26 | |||
| 25 | <YueDisplay> | 27 | <YueDisplay> |
| 26 | 28 | ||
| 27 | ```yue | 29 | ```yue |
| @@ -42,6 +44,7 @@ profile = | |||
| 42 | shoe_size: 13, | 44 | shoe_size: 13, |
| 43 | favorite_foods: ["ice cream", "donuts"] | 45 | favorite_foods: ["ice cream", "donuts"] |
| 44 | ``` | 46 | ``` |
| 47 | |||
| 45 | <YueDisplay> | 48 | <YueDisplay> |
| 46 | 49 | ||
| 47 | ```yue | 50 | ```yue |
| @@ -63,6 +66,7 @@ values = { | |||
| 63 | occupation: "crime fighting" | 66 | occupation: "crime fighting" |
| 64 | } | 67 | } |
| 65 | ``` | 68 | ``` |
| 69 | |||
| 66 | <YueDisplay> | 70 | <YueDisplay> |
| 67 | 71 | ||
| 68 | ```yue | 72 | ```yue |
| @@ -83,6 +87,7 @@ my_function dance: "Tango", partner: "none" | |||
| 83 | 87 | ||
| 84 | y = type: "dog", legs: 4, tails: 1 | 88 | y = type: "dog", legs: 4, tails: 1 |
| 85 | ``` | 89 | ``` |
| 90 | |||
| 86 | <YueDisplay> | 91 | <YueDisplay> |
| 87 | 92 | ||
| 88 | ```yue | 93 | ```yue |
| @@ -101,6 +106,7 @@ tbl = { | |||
| 101 | end: "hunger" | 106 | end: "hunger" |
| 102 | } | 107 | } |
| 103 | ``` | 108 | ``` |
| 109 | |||
| 104 | <YueDisplay> | 110 | <YueDisplay> |
| 105 | 111 | ||
| 106 | ```yue | 112 | ```yue |
| @@ -121,6 +127,7 @@ person = { :hair, :height, shoe_size: 40 } | |||
| 121 | 127 | ||
| 122 | print_table :hair, :height | 128 | print_table :hair, :height |
| 123 | ``` | 129 | ``` |
| 130 | |||
| 124 | <YueDisplay> | 131 | <YueDisplay> |
| 125 | 132 | ||
| 126 | ```yue | 133 | ```yue |
| @@ -141,6 +148,7 @@ t = { | |||
| 141 | "hello world": true | 148 | "hello world": true |
| 142 | } | 149 | } |
| 143 | ``` | 150 | ``` |
| 151 | |||
| 144 | <YueDisplay> | 152 | <YueDisplay> |
| 145 | 153 | ||
| 146 | ```yue | 154 | ```yue |
| @@ -158,6 +166,7 @@ Tabel Lua memiliki bagian array dan bagian hash, tetapi terkadang Anda ingin mem | |||
| 158 | some_values = [1, 2, 3, 4] | 166 | some_values = [1, 2, 3, 4] |
| 159 | list_with_one_element = [1, ] | 167 | list_with_one_element = [1, ] |
| 160 | ``` | 168 | ``` |
| 169 | |||
| 161 | <YueDisplay> | 170 | <YueDisplay> |
| 162 | 171 | ||
| 163 | ```yue | 172 | ```yue |
diff --git a/doc/docs/id-id/doc/functions/backcalls.md b/doc/docs/id-id/doc/functions/backcalls.md index 8d542ee..9de64c3 100644 --- a/doc/docs/id-id/doc/functions/backcalls.md +++ b/doc/docs/id-id/doc/functions/backcalls.md | |||
| @@ -6,6 +6,7 @@ Backcall digunakan untuk meratakan callback yang bersarang. Backcall didefinisik | |||
| 6 | x <- f | 6 | x <- f |
| 7 | print "hello" .. x | 7 | print "hello" .. x |
| 8 | ``` | 8 | ``` |
| 9 | |||
| 9 | <YueDisplay> | 10 | <YueDisplay> |
| 10 | 11 | ||
| 11 | ```yue | 12 | ```yue |
| @@ -21,6 +22,7 @@ Fungsi panah tebal juga tersedia. | |||
| 21 | <= f | 22 | <= f |
| 22 | print @value | 23 | print @value |
| 23 | ``` | 24 | ``` |
| 25 | |||
| 24 | <YueDisplay> | 26 | <YueDisplay> |
| 25 | 27 | ||
| 26 | ```yue | 28 | ```yue |
| @@ -36,6 +38,7 @@ Anda dapat menentukan placeholder untuk posisi fungsi backcall sebagai parameter | |||
| 36 | (x) <- map _, [1, 2, 3] | 38 | (x) <- map _, [1, 2, 3] |
| 37 | x * 2 | 39 | x * 2 |
| 38 | ``` | 40 | ``` |
| 41 | |||
| 39 | <YueDisplay> | 42 | <YueDisplay> |
| 40 | 43 | ||
| 41 | ```yue | 44 | ```yue |
| @@ -55,6 +58,7 @@ result, msg = do | |||
| 55 | check info | 58 | check info |
| 56 | print result, msg | 59 | print result, msg |
| 57 | ``` | 60 | ``` |
| 61 | |||
| 58 | <YueDisplay> | 62 | <YueDisplay> |
| 59 | 63 | ||
| 60 | ```yue | 64 | ```yue |
diff --git a/doc/docs/id-id/doc/functions/function-literals.md b/doc/docs/id-id/doc/functions/function-literals.md index 589a26d..67ae158 100644 --- a/doc/docs/id-id/doc/functions/function-literals.md +++ b/doc/docs/id-id/doc/functions/function-literals.md | |||
| @@ -6,6 +6,7 @@ Semua fungsi dibuat menggunakan ekspresi fungsi. Fungsi sederhana ditandai denga | |||
| 6 | my_function = -> | 6 | my_function = -> |
| 7 | my_function() -- memanggil fungsi kosong | 7 | my_function() -- memanggil fungsi kosong |
| 8 | ``` | 8 | ``` |
| 9 | |||
| 9 | <YueDisplay> | 10 | <YueDisplay> |
| 10 | 11 | ||
| 11 | ```yue | 12 | ```yue |
| @@ -24,6 +25,7 @@ func_b = -> | |||
| 24 | value = 100 | 25 | value = 100 |
| 25 | print "The value:", value | 26 | print "The value:", value |
| 26 | ``` | 27 | ``` |
| 28 | |||
| 27 | <YueDisplay> | 29 | <YueDisplay> |
| 28 | 30 | ||
| 29 | ```yue | 31 | ```yue |
| @@ -42,6 +44,7 @@ Jika fungsi tidak memiliki argumen, ia dapat dipanggil menggunakan operator `!`, | |||
| 42 | func_a! | 44 | func_a! |
| 43 | func_b() | 45 | func_b() |
| 44 | ``` | 46 | ``` |
| 47 | |||
| 45 | <YueDisplay> | 48 | <YueDisplay> |
| 46 | 49 | ||
| 47 | ```yue | 50 | ```yue |
| @@ -56,6 +59,7 @@ Fungsi dengan argumen dapat dibuat dengan menaruh daftar nama argumen dalam tand | |||
| 56 | ```yuescript | 59 | ```yuescript |
| 57 | sum = (x, y) -> print "sum", x + y | 60 | sum = (x, y) -> print "sum", x + y |
| 58 | ``` | 61 | ``` |
| 62 | |||
| 59 | <YueDisplay> | 63 | <YueDisplay> |
| 60 | 64 | ||
| 61 | ```yue | 65 | ```yue |
| @@ -72,6 +76,7 @@ print sum 10, 20 | |||
| 72 | 76 | ||
| 73 | a b c "a", "b", "c" | 77 | a b c "a", "b", "c" |
| 74 | ``` | 78 | ``` |
| 79 | |||
| 75 | <YueDisplay> | 80 | <YueDisplay> |
| 76 | 81 | ||
| 77 | ```yue | 82 | ```yue |
| @@ -88,6 +93,7 @@ Untuk menghindari ambiguitas saat memanggil fungsi, tanda kurung juga bisa digun | |||
| 88 | ```yuescript | 93 | ```yuescript |
| 89 | print "x:", sum(10, 20), "y:", sum(30, 40) | 94 | print "x:", sum(10, 20), "y:", sum(30, 40) |
| 90 | ``` | 95 | ``` |
| 96 | |||
| 91 | <YueDisplay> | 97 | <YueDisplay> |
| 92 | 98 | ||
| 93 | ```yue | 99 | ```yue |
| @@ -104,6 +110,7 @@ Fungsi akan memaksa pernyataan terakhir di badannya menjadi pernyataan return, i | |||
| 104 | sum = (x, y) -> x + y | 110 | sum = (x, y) -> x + y |
| 105 | print "The sum is ", sum 10, 20 | 111 | print "The sum is ", sum 10, 20 |
| 106 | ``` | 112 | ``` |
| 113 | |||
| 107 | <YueDisplay> | 114 | <YueDisplay> |
| 108 | 115 | ||
| 109 | ```yue | 116 | ```yue |
| @@ -118,6 +125,7 @@ Dan jika Anda perlu return secara eksplisit, Anda bisa menggunakan kata kunci `r | |||
| 118 | ```yuescript | 125 | ```yuescript |
| 119 | sum = (x, y) -> return x + y | 126 | sum = (x, y) -> return x + y |
| 120 | ``` | 127 | ``` |
| 128 | |||
| 121 | <YueDisplay> | 129 | <YueDisplay> |
| 122 | 130 | ||
| 123 | ```yue | 131 | ```yue |
| @@ -132,6 +140,7 @@ Seperti di Lua, fungsi dapat mengembalikan beberapa nilai. Pernyataan terakhir h | |||
| 132 | mystery = (x, y) -> x + y, x - y | 140 | mystery = (x, y) -> x + y, x - y |
| 133 | a, b = mystery 10, 20 | 141 | a, b = mystery 10, 20 |
| 134 | ``` | 142 | ``` |
| 143 | |||
| 135 | <YueDisplay> | 144 | <YueDisplay> |
| 136 | 145 | ||
| 137 | ```yue | 146 | ```yue |
| @@ -148,6 +157,7 @@ Karena sudah menjadi idiom di Lua untuk mengirim objek sebagai argumen pertama s | |||
| 148 | ```yuescript | 157 | ```yuescript |
| 149 | func = (num) => @value + num | 158 | func = (num) => @value + num |
| 150 | ``` | 159 | ``` |
| 160 | |||
| 151 | <YueDisplay> | 161 | <YueDisplay> |
| 152 | 162 | ||
| 153 | ```yue | 163 | ```yue |
| @@ -165,6 +175,7 @@ my_function = (name = "something", height = 100) -> | |||
| 165 | print "Hello I am", name | 175 | print "Hello I am", name |
| 166 | print "My height is", height | 176 | print "My height is", height |
| 167 | ``` | 177 | ``` |
| 178 | |||
| 168 | <YueDisplay> | 179 | <YueDisplay> |
| 169 | 180 | ||
| 170 | ```yue | 181 | ```yue |
| @@ -181,6 +192,7 @@ Ekspresi nilai default argumen dievaluasi di dalam badan fungsi sesuai urutan de | |||
| 181 | some_args = (x = 100, y = x + 1000) -> | 192 | some_args = (x = 100, y = x + 1000) -> |
| 182 | print x + y | 193 | print x + y |
| 183 | ``` | 194 | ``` |
| 195 | |||
| 184 | <YueDisplay> | 196 | <YueDisplay> |
| 185 | 197 | ||
| 186 | ```yue | 198 | ```yue |
| @@ -202,6 +214,7 @@ b = x-10 | |||
| 202 | c = x -y | 214 | c = x -y |
| 203 | d = x- z | 215 | d = x- z |
| 204 | ``` | 216 | ``` |
| 217 | |||
| 205 | <YueDisplay> | 218 | <YueDisplay> |
| 206 | 219 | ||
| 207 | ```yue | 220 | ```yue |
| @@ -223,6 +236,7 @@ Ketika ada spasi setelah variabel dan literal string, pemanggilan fungsi bertind | |||
| 223 | x = func"hello" + 100 | 236 | x = func"hello" + 100 |
| 224 | y = func "hello" + 100 | 237 | y = func "hello" + 100 |
| 225 | ``` | 238 | ``` |
| 239 | |||
| 226 | <YueDisplay> | 240 | <YueDisplay> |
| 227 | 241 | ||
| 228 | ```yue | 242 | ```yue |
| @@ -247,6 +261,7 @@ cool_func 1, 2, | |||
| 247 | 5, 6, | 261 | 5, 6, |
| 248 | 7, 8 | 262 | 7, 8 |
| 249 | ``` | 263 | ``` |
| 264 | |||
| 250 | <YueDisplay> | 265 | <YueDisplay> |
| 251 | 266 | ||
| 252 | ```yue | 267 | ```yue |
| @@ -269,6 +284,7 @@ my_func 5, 6, 7, | |||
| 269 | 9, 1, 2, | 284 | 9, 1, 2, |
| 270 | 5, 4 | 285 | 5, 4 |
| 271 | ``` | 286 | ``` |
| 287 | |||
| 272 | <YueDisplay> | 288 | <YueDisplay> |
| 273 | 289 | ||
| 274 | ```yue | 290 | ```yue |
| @@ -289,6 +305,7 @@ x = [ | |||
| 289 | 8, 9, 10 | 305 | 8, 9, 10 |
| 290 | ] | 306 | ] |
| 291 | ``` | 307 | ``` |
| 308 | |||
| 292 | <YueDisplay> | 309 | <YueDisplay> |
| 293 | 310 | ||
| 294 | ```yue | 311 | ```yue |
| @@ -309,6 +326,7 @@ y = [ my_func 1, 2, 3, | |||
| 309 | 5, 6, 7 | 326 | 5, 6, 7 |
| 310 | ] | 327 | ] |
| 311 | ``` | 328 | ``` |
| 329 | |||
| 312 | <YueDisplay> | 330 | <YueDisplay> |
| 313 | 331 | ||
| 314 | ```yue | 332 | ```yue |
| @@ -335,6 +353,7 @@ if func 1, 2, 3, | |||
| 335 | print "hello" | 353 | print "hello" |
| 336 | print "I am inside if" | 354 | print "I am inside if" |
| 337 | ``` | 355 | ``` |
| 356 | |||
| 338 | <YueDisplay> | 357 | <YueDisplay> |
| 339 | 358 | ||
| 340 | ```yue | 359 | ```yue |
| @@ -357,9 +376,9 @@ if func 1, 2, 3, | |||
| 357 | 376 | ||
| 358 | YueScript kini mendukung destrukturisasi parameter fungsi ketika argumen berupa objek. Dua bentuk destrukturisasi literal tabel tersedia: | 377 | YueScript kini mendukung destrukturisasi parameter fungsi ketika argumen berupa objek. Dua bentuk destrukturisasi literal tabel tersedia: |
| 359 | 378 | ||
| 360 | * **Literal berkurung kurawal/parameter objek**, memungkinkan nilai default opsional ketika field hilang (misalnya, `{:a, :b}`, `{a: a1 = 123}`). | 379 | - **Literal berkurung kurawal/parameter objek**, memungkinkan nilai default opsional ketika field hilang (misalnya, `{:a, :b}`, `{a: a1 = 123}`). |
| 361 | 380 | ||
| 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. | 381 | - **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 | 382 | ||
| 364 | ```yuescript | 383 | ```yuescript |
| 365 | f1 = (:a, :b, :c) -> | 384 | f1 = (:a, :b, :c) -> |
| @@ -373,6 +392,7 @@ f2 = ({a: a1 = 123, :b = 'abc'}, c = {}) -> | |||
| 373 | arg1 = {a: 0} | 392 | arg1 = {a: 0} |
| 374 | f2 arg1, arg2 | 393 | f2 arg1, arg2 |
| 375 | ``` | 394 | ``` |
| 395 | |||
| 376 | <YueDisplay> | 396 | <YueDisplay> |
| 377 | 397 | ||
| 378 | ```yue | 398 | ```yue |
| @@ -402,6 +422,7 @@ findFirstEven = (list): nil -> | |||
| 402 | if sub % 2 == 0 | 422 | if sub % 2 == 0 |
| 403 | return sub | 423 | return sub |
| 404 | ``` | 424 | ``` |
| 425 | |||
| 405 | <YueDisplay> | 426 | <YueDisplay> |
| 406 | 427 | ||
| 407 | ```yue | 428 | ```yue |
| @@ -426,6 +447,7 @@ findFirstEven = (list) -> | |||
| 426 | return sub | 447 | return sub |
| 427 | nil | 448 | nil |
| 428 | ``` | 449 | ``` |
| 450 | |||
| 429 | <YueDisplay> | 451 | <YueDisplay> |
| 430 | 452 | ||
| 431 | ```yue | 453 | ```yue |
| @@ -467,6 +489,7 @@ process = (...args) -> | |||
| 467 | 489 | ||
| 468 | process 1, nil, 3, nil, 5 | 490 | process 1, nil, 3, nil, 5 |
| 469 | ``` | 491 | ``` |
| 492 | |||
| 470 | <YueDisplay> | 493 | <YueDisplay> |
| 471 | 494 | ||
| 472 | ```yue | 495 | ```yue |
diff --git a/doc/docs/id-id/doc/functions/function-stubs.md b/doc/docs/id-id/doc/functions/function-stubs.md index 57ed5c1..87dfd73 100644 --- a/doc/docs/id-id/doc/functions/function-stubs.md +++ b/doc/docs/id-id/doc/functions/function-stubs.md | |||
| @@ -24,6 +24,7 @@ run_callback my_object.write | |||
| 24 | -- memungkinkan kita membundel objek ke fungsi baru | 24 | -- memungkinkan kita membundel objek ke fungsi baru |
| 25 | run_callback my_object\write | 25 | run_callback my_object\write |
| 26 | ``` | 26 | ``` |
| 27 | |||
| 27 | <YueDisplay> | 28 | <YueDisplay> |
| 28 | 29 | ||
| 29 | ```yue | 30 | ```yue |
diff --git a/doc/docs/id-id/doc/getting-started/usage.md b/doc/docs/id-id/doc/getting-started/usage.md index 85cad07..a9523f7 100644 --- a/doc/docs/id-id/doc/getting-started/usage.md +++ b/doc/docs/id-id/doc/getting-started/usage.md | |||
| @@ -4,49 +4,51 @@ | |||
| 4 | 4 | ||
| 5 | Gunakan modul YueScript di Lua: | 5 | Gunakan modul YueScript di Lua: |
| 6 | 6 | ||
| 7 | * **Kasus 1** | 7 | - **Kasus 1** |
| 8 | 8 | ||
| 9 | Require "your_yuescript_entry.yue" di Lua. | 9 | Require "your_yuescript_entry.yue" di Lua. |
| 10 | ```Lua | 10 | |
| 11 | require("yue")("your_yuescript_entry") | 11 | ```Lua |
| 12 | ``` | 12 | require("yue")("your_yuescript_entry") |
| 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. | 13 | ``` |
| 14 | 14 | ||
| 15 | * **Kasus 2** | 15 | 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. |
| 16 | 16 | ||
| 17 | Require modul YueScript dan tulis ulang pesan secara manual. | 17 | - **Kasus 2** |
| 18 | 18 | ||
| 19 | ```lua | 19 | Require modul YueScript dan tulis ulang pesan secara manual. |
| 20 | local yue = require("yue") | 20 | |
| 21 | yue.insert_loader() | 21 | ```lua |
| 22 | local success, result = xpcall(function() | 22 | local yue = require("yue") |
| 23 | return require("yuescript_module_name") | 23 | yue.insert_loader() |
| 24 | end, function(err) | 24 | local success, result = xpcall(function() |
| 25 | return yue.traceback(err) | 25 | return require("yuescript_module_name") |
| 26 | end) | 26 | end, function(err) |
| 27 | ``` | 27 | return yue.traceback(err) |
| 28 | 28 | end) | |
| 29 | * **Kasus 3** | 29 | ``` |
| 30 | 30 | ||
| 31 | Gunakan fungsi kompiler YueScript di Lua. | 31 | - **Kasus 3** |
| 32 | 32 | ||
| 33 | ```lua | 33 | Gunakan fungsi kompiler YueScript di Lua. |
| 34 | local yue = require("yue") | 34 | |
| 35 | local codes, err, globals = yue.to_lua([[ | 35 | ```lua |
| 36 | f = -> | 36 | local yue = require("yue") |
| 37 | print "hello world" | 37 | local codes, err, globals = yue.to_lua([[ |
| 38 | f! | 38 | f = -> |
| 39 | ]],{ | 39 | print "hello world" |
| 40 | implicit_return_root = true, | 40 | f! |
| 41 | reserve_line_number = true, | 41 | ]],{ |
| 42 | lint_global = true, | 42 | implicit_return_root = true, |
| 43 | space_over_tab = false, | 43 | reserve_line_number = true, |
| 44 | options = { | 44 | lint_global = true, |
| 45 | target = "5.4", | 45 | space_over_tab = false, |
| 46 | path = "/script" | 46 | options = { |
| 47 | } | 47 | target = "5.4", |
| 48 | }) | 48 | path = "/script" |
| 49 | ``` | 49 | } |
| 50 | }) | ||
| 51 | ``` | ||
| 50 | 52 | ||
| 51 | ## Tool YueScript | 53 | ## Tool YueScript |
| 52 | 54 | ||
| @@ -99,14 +101,14 @@ Opsi: | |||
| 99 | 101 | ||
| 100 | Gunakan kasus: | 102 | Gunakan kasus: |
| 101 | 103 | ||
| 102 | Kompilasi semua file YueScript dengan ekstensi **.yue** secara rekursif di bawah path saat ini: **yue .** | 104 | Kompilasi semua file YueScript dengan ekstensi **.yue** secara rekursif di bawah path saat ini: **yue .** |
| 103 | 105 | ||
| 104 | Kompilasi dan simpan hasil ke path target: **yue -t /target/path/ .** | 106 | Kompilasi dan simpan hasil ke path target: **yue -t /target/path/ .** |
| 105 | 107 | ||
| 106 | Kompilasi dan pertahankan info debug: **yue -l .** | 108 | Kompilasi dan pertahankan info debug: **yue -l .** |
| 107 | 109 | ||
| 108 | Kompilasi dan hasilkan kode yang diminisasi: **yue -m .** | 110 | Kompilasi dan hasilkan kode yang diminisasi: **yue -m .** |
| 109 | 111 | ||
| 110 | Eksekusi kode mentah: **yue -e 'print 123'** | 112 | Eksekusi kode mentah: **yue -e 'print 123'** |
| 111 | 113 | ||
| 112 | Eksekusi file YueScript: **yue -e main.yue** | 114 | Eksekusi file YueScript: **yue -e main.yue** |
diff --git a/doc/docs/id-id/doc/language-basics/attributes.md b/doc/docs/id-id/doc/language-basics/attributes.md index 5b92947..20b7c9c 100644 --- a/doc/docs/id-id/doc/language-basics/attributes.md +++ b/doc/docs/id-id/doc/language-basics/attributes.md | |||
| @@ -6,6 +6,7 @@ Dukungan sintaks untuk atribut Lua 5.4. Anda juga masih bisa menggunakan deklara | |||
| 6 | const a = 123 | 6 | const a = 123 |
| 7 | close _ = <close>: -> print "Out of scope." | 7 | close _ = <close>: -> print "Out of scope." |
| 8 | ``` | 8 | ``` |
| 9 | |||
| 9 | <YueDisplay> | 10 | <YueDisplay> |
| 10 | 11 | ||
| 11 | ```yue | 12 | ```yue |
| @@ -21,6 +22,7 @@ Anda dapat melakukan destrukturisasi dengan variabel yang diberi atribut sebagai | |||
| 21 | const {:a, :b, c, d} = tb | 22 | const {:a, :b, c, d} = tb |
| 22 | -- a = 1 | 23 | -- a = 1 |
| 23 | ``` | 24 | ``` |
| 25 | |||
| 24 | <YueDisplay> | 26 | <YueDisplay> |
| 25 | 27 | ||
| 26 | ```yue | 28 | ```yue |
| @@ -36,6 +38,7 @@ Anda juga bisa mendeklarasikan variabel global sebagai `const`. | |||
| 36 | global const Constant = 123 | 38 | global const Constant = 123 |
| 37 | -- Constant = 1 | 39 | -- Constant = 1 |
| 38 | ``` | 40 | ``` |
| 41 | |||
| 39 | <YueDisplay> | 42 | <YueDisplay> |
| 40 | 43 | ||
| 41 | ```yue | 44 | ```yue |
diff --git a/doc/docs/id-id/doc/language-basics/comment.md b/doc/docs/id-id/doc/language-basics/comment.md index 99f7b51..058c66b 100644 --- a/doc/docs/id-id/doc/language-basics/comment.md +++ b/doc/docs/id-id/doc/language-basics/comment.md | |||
| @@ -12,6 +12,7 @@ Tidak masalah. | |||
| 12 | 12 | ||
| 13 | func --[[port]] 3000, --[[ip]] "192.168.1.1" | 13 | func --[[port]] 3000, --[[ip]] "192.168.1.1" |
| 14 | ``` | 14 | ``` |
| 15 | |||
| 15 | <YueDisplay> | 16 | <YueDisplay> |
| 16 | 17 | ||
| 17 | ```yue | 18 | ```yue |
diff --git a/doc/docs/id-id/doc/language-basics/literals.md b/doc/docs/id-id/doc/language-basics/literals.md index c17c310..93a547b 100644 --- a/doc/docs/id-id/doc/language-basics/literals.md +++ b/doc/docs/id-id/doc/language-basics/literals.md | |||
| @@ -12,6 +12,7 @@ some_string = "Here is a string | |||
| 12 | -- Interpolasi string hanya tersedia pada string dengan tanda kutip ganda. | 12 | -- Interpolasi string hanya tersedia pada string dengan tanda kutip ganda. |
| 13 | print "I am #{math.random! * 100}% sure." | 13 | print "I am #{math.random! * 100}% sure." |
| 14 | ``` | 14 | ``` |
| 15 | |||
| 15 | <YueDisplay> | 16 | <YueDisplay> |
| 16 | 17 | ||
| 17 | ```yue | 18 | ```yue |
| @@ -34,6 +35,7 @@ integer = 1_000_000 | |||
| 34 | hex = 0xEF_BB_BF | 35 | hex = 0xEF_BB_BF |
| 35 | binary = 0B10011 | 36 | binary = 0B10011 |
| 36 | ``` | 37 | ``` |
| 38 | |||
| 37 | <YueDisplay> | 39 | <YueDisplay> |
| 38 | 40 | ||
| 39 | ```yue | 41 | ```yue |
| @@ -55,6 +57,7 @@ str = | | |||
| 55 | - item1 | 57 | - item1 |
| 56 | - #{expr} | 58 | - #{expr} |
| 57 | ``` | 59 | ``` |
| 60 | |||
| 58 | <YueDisplay> | 61 | <YueDisplay> |
| 59 | 62 | ||
| 60 | ```yue | 63 | ```yue |
| @@ -78,6 +81,7 @@ fn = -> | |||
| 78 | bar: baz | 81 | bar: baz |
| 79 | return str | 82 | return str |
| 80 | ``` | 83 | ``` |
| 84 | |||
| 81 | <YueDisplay> | 85 | <YueDisplay> |
| 82 | 86 | ||
| 83 | ```yue | 87 | ```yue |
| @@ -99,6 +103,7 @@ str = | | |||
| 99 | path: "C:\Program Files\App" | 103 | path: "C:\Program Files\App" |
| 100 | note: 'He said: "#{Hello}!"' | 104 | note: 'He said: "#{Hello}!"' |
| 101 | ``` | 105 | ``` |
| 106 | |||
| 102 | <YueDisplay> | 107 | <YueDisplay> |
| 103 | 108 | ||
| 104 | ```yue | 109 | ```yue |
diff --git a/doc/docs/id-id/doc/language-basics/operator.md b/doc/docs/id-id/doc/language-basics/operator.md index f3fe092..6e0030a 100644 --- a/doc/docs/id-id/doc/language-basics/operator.md +++ b/doc/docs/id-id/doc/language-basics/operator.md | |||
| @@ -6,6 +6,7 @@ Semua operator biner dan unari Lua tersedia. Selain itu **!=** adalah alias untu | |||
| 6 | tb\func! if tb ~= nil | 6 | tb\func! if tb ~= nil |
| 7 | tb::func! if tb != nil | 7 | tb::func! if tb != nil |
| 8 | ``` | 8 | ``` |
| 9 | |||
| 9 | <YueDisplay> | 10 | <YueDisplay> |
| 10 | 11 | ||
| 11 | ```yue | 12 | ```yue |
| @@ -27,6 +28,7 @@ a = 5 | |||
| 27 | print 1 <= a <= 10 | 28 | print 1 <= a <= 10 |
| 28 | -- output: true | 29 | -- output: true |
| 29 | ``` | 30 | ``` |
| 31 | |||
| 30 | <YueDisplay> | 32 | <YueDisplay> |
| 31 | 33 | ||
| 32 | ```yue | 34 | ```yue |
| @@ -64,6 +66,7 @@ print v(1) > v(2) <= v(3) | |||
| 64 | false | 66 | false |
| 65 | ]] | 67 | ]] |
| 66 | ``` | 68 | ``` |
| 69 | |||
| 67 | <YueDisplay> | 70 | <YueDisplay> |
| 68 | 71 | ||
| 69 | ```yue | 72 | ```yue |
| @@ -101,6 +104,7 @@ Operator **[] =** digunakan untuk menambahkan nilai ke tabel. | |||
| 101 | tab = [] | 104 | tab = [] |
| 102 | tab[] = "Value" | 105 | tab[] = "Value" |
| 103 | ``` | 106 | ``` |
| 107 | |||
| 104 | <YueDisplay> | 108 | <YueDisplay> |
| 105 | 109 | ||
| 106 | ```yue | 110 | ```yue |
| @@ -118,6 +122,7 @@ tbB = [4, 5, 6] | |||
| 118 | tbA[] = ...tbB | 122 | tbA[] = ...tbB |
| 119 | -- tbA sekarang [1, 2, 3, 4, 5, 6] | 123 | -- tbA sekarang [1, 2, 3, 4, 5, 6] |
| 120 | ``` | 124 | ``` |
| 125 | |||
| 121 | <YueDisplay> | 126 | <YueDisplay> |
| 122 | 127 | ||
| 123 | ```yue | 128 | ```yue |
| @@ -149,6 +154,7 @@ a = {1, 2, 3, x: 1} | |||
| 149 | b = {4, 5, y: 1} | 154 | b = {4, 5, y: 1} |
| 150 | merge = {...a, ...b} | 155 | merge = {...a, ...b} |
| 151 | ``` | 156 | ``` |
| 157 | |||
| 152 | <YueDisplay> | 158 | <YueDisplay> |
| 153 | 159 | ||
| 154 | ```yue | 160 | ```yue |
| @@ -179,6 +185,7 @@ last = data.items[#] | |||
| 179 | second_last = data.items[#-1] | 185 | second_last = data.items[#-1] |
| 180 | data.items[#] = 1 | 186 | data.items[#] = 1 |
| 181 | ``` | 187 | ``` |
| 188 | |||
| 182 | <YueDisplay> | 189 | <YueDisplay> |
| 183 | 190 | ||
| 184 | ```yue | 191 | ```yue |
| @@ -212,6 +219,7 @@ print d.value | |||
| 212 | 219 | ||
| 213 | close _ = <close>: -> print "out of scope" | 220 | close _ = <close>: -> print "out of scope" |
| 214 | ``` | 221 | ``` |
| 222 | |||
| 215 | <YueDisplay> | 223 | <YueDisplay> |
| 216 | 224 | ||
| 217 | ```yue | 225 | ```yue |
| @@ -245,6 +253,7 @@ print tb.value | |||
| 245 | tb.<> = __index: {item: "hello"} | 253 | tb.<> = __index: {item: "hello"} |
| 246 | print tb.item | 254 | print tb.item |
| 247 | ``` | 255 | ``` |
| 256 | |||
| 248 | <YueDisplay> | 257 | <YueDisplay> |
| 249 | 258 | ||
| 250 | ```yue | 259 | ```yue |
| @@ -266,6 +275,7 @@ Destrukturisasi metatable dengan kunci metamethod yang dikelilingi **<>**. | |||
| 266 | {item, :new, :<close>, <index>: getter} = tb | 275 | {item, :new, :<close>, <index>: getter} = tb |
| 267 | print item, new, close, getter | 276 | print item, new, close, getter |
| 268 | ``` | 277 | ``` |
| 278 | |||
| 269 | <YueDisplay> | 279 | <YueDisplay> |
| 270 | 280 | ||
| 271 | ```yue | 281 | ```yue |
| @@ -293,6 +303,7 @@ with? io.open "test.txt", "w" | |||
| 293 | \write "hello" | 303 | \write "hello" |
| 294 | \close! | 304 | \close! |
| 295 | ``` | 305 | ``` |
| 306 | |||
| 296 | <YueDisplay> | 307 | <YueDisplay> |
| 297 | 308 | ||
| 298 | ```yue | 309 | ```yue |
| @@ -329,6 +340,7 @@ readFile "example.txt" | |||
| 329 | |> render | 340 | |> render |
| 330 | 341 | ||
| 331 | ``` | 342 | ``` |
| 343 | |||
| 332 | <YueDisplay> | 344 | <YueDisplay> |
| 333 | 345 | ||
| 334 | ```yue | 346 | ```yue |
| @@ -349,6 +361,7 @@ readFile "example.txt" | |||
| 349 | ## Nil Coalescing | 361 | ## Nil Coalescing |
| 350 | 362 | ||
| 351 | Operator 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. | 363 | Operator 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. |
| 364 | |||
| 352 | ```yuescript | 365 | ```yuescript |
| 353 | local a, b, c, d | 366 | local a, b, c, d |
| 354 | a = b ?? c ?? d | 367 | a = b ?? c ?? d |
| @@ -356,6 +369,7 @@ func a ?? {} | |||
| 356 | 369 | ||
| 357 | a ??= false | 370 | a ??= false |
| 358 | ``` | 371 | ``` |
| 372 | |||
| 359 | <YueDisplay> | 373 | <YueDisplay> |
| 360 | 374 | ||
| 361 | ```yue | 375 | ```yue |
| @@ -413,6 +427,7 @@ tb = | |||
| 413 | tb: { } | 427 | tb: { } |
| 414 | 428 | ||
| 415 | ``` | 429 | ``` |
| 430 | |||
| 416 | <YueDisplay> | 431 | <YueDisplay> |
| 417 | 432 | ||
| 418 | ```yue | 433 | ```yue |
diff --git a/doc/docs/id-id/doc/language-basics/whitespace.md b/doc/docs/id-id/doc/language-basics/whitespace.md index bdc124e..486bcaa 100644 --- a/doc/docs/id-id/doc/language-basics/whitespace.md +++ b/doc/docs/id-id/doc/language-basics/whitespace.md | |||
| @@ -9,6 +9,7 @@ Sebuah pernyataan biasanya berakhir pada pergantian baris. Anda juga bisa memaka | |||
| 9 | ```yuescript | 9 | ```yuescript |
| 10 | a = 1; b = 2; print a + b | 10 | a = 1; b = 2; print a + b |
| 11 | ``` | 11 | ``` |
| 12 | |||
| 12 | <YueDisplay> | 13 | <YueDisplay> |
| 13 | 14 | ||
| 14 | ```yue | 15 | ```yue |
| @@ -29,6 +30,7 @@ Rx.Observable | |||
| 29 | \map (value) -> value .. '!' | 30 | \map (value) -> value .. '!' |
| 30 | \subscribe print | 31 | \subscribe print |
| 31 | ``` | 32 | ``` |
| 33 | |||
| 32 | <YueDisplay> | 34 | <YueDisplay> |
| 33 | 35 | ||
| 34 | ```yue | 36 | ```yue |
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 96c19d7..7d5d420 100644 --- a/doc/docs/id-id/doc/objects/object-oriented-programming.md +++ b/doc/docs/id-id/doc/objects/object-oriented-programming.md | |||
| @@ -15,6 +15,7 @@ class Inventory | |||
| 15 | else | 15 | else |
| 16 | @items[name] = 1 | 16 | @items[name] = 1 |
| 17 | ``` | 17 | ``` |
| 18 | |||
| 18 | <YueDisplay> | 19 | <YueDisplay> |
| 19 | 20 | ||
| 20 | ```yue | 21 | ```yue |
| @@ -46,6 +47,7 @@ inv = Inventory! | |||
| 46 | inv\add_item "t-shirt" | 47 | inv\add_item "t-shirt" |
| 47 | inv\add_item "pants" | 48 | inv\add_item "pants" |
| 48 | ``` | 49 | ``` |
| 50 | |||
| 49 | <YueDisplay> | 51 | <YueDisplay> |
| 50 | 52 | ||
| 51 | ```yue | 53 | ```yue |
| @@ -77,6 +79,7 @@ b\give_item "shirt" | |||
| 77 | -- akan mencetak pants dan shirt | 79 | -- akan mencetak pants dan shirt |
| 78 | print item for item in *a.clothes | 80 | print item for item in *a.clothes |
| 79 | ``` | 81 | ``` |
| 82 | |||
| 80 | <YueDisplay> | 83 | <YueDisplay> |
| 81 | 84 | ||
| 82 | ```yue | 85 | ```yue |
| @@ -104,6 +107,7 @@ class Person | |||
| 104 | new: => | 107 | new: => |
| 105 | @clothes = [] | 108 | @clothes = [] |
| 106 | ``` | 109 | ``` |
| 110 | |||
| 107 | <YueDisplay> | 111 | <YueDisplay> |
| 108 | 112 | ||
| 109 | ```yue | 113 | ```yue |
| @@ -125,6 +129,7 @@ class BackPack extends Inventory | |||
| 125 | if #@items > size then error "backpack is full" | 129 | if #@items > size then error "backpack is full" |
| 126 | super name | 130 | super name |
| 127 | ``` | 131 | ``` |
| 132 | |||
| 128 | <YueDisplay> | 133 | <YueDisplay> |
| 129 | 134 | ||
| 130 | ```yue | 135 | ```yue |
| @@ -151,6 +156,7 @@ class Shelf | |||
| 151 | -- akan mencetak: Shelf was inherited by Cupboard | 156 | -- akan mencetak: Shelf was inherited by Cupboard |
| 152 | class Cupboard extends Shelf | 157 | class Cupboard extends Shelf |
| 153 | ``` | 158 | ``` |
| 159 | |||
| 154 | <YueDisplay> | 160 | <YueDisplay> |
| 155 | 161 | ||
| 156 | ```yue | 162 | ```yue |
| @@ -189,6 +195,7 @@ class MyClass extends ParentClass | |||
| 189 | -- super sebagai nilai sama dengan kelas induk: | 195 | -- super sebagai nilai sama dengan kelas induk: |
| 190 | assert super == ParentClass | 196 | assert super == ParentClass |
| 191 | ``` | 197 | ``` |
| 198 | |||
| 192 | <YueDisplay> | 199 | <YueDisplay> |
| 193 | 200 | ||
| 194 | ```yue | 201 | ```yue |
| @@ -217,6 +224,7 @@ assert b.__class == BackPack | |||
| 217 | 224 | ||
| 218 | print BackPack.size -- mencetak 10 | 225 | print BackPack.size -- mencetak 10 |
| 219 | ``` | 226 | ``` |
| 227 | |||
| 220 | <YueDisplay> | 228 | <YueDisplay> |
| 221 | 229 | ||
| 222 | ```yue | 230 | ```yue |
| @@ -247,6 +255,7 @@ Nama kelas saat dideklarasikan disimpan sebagai string di field `__name` pada ob | |||
| 247 | ```yuescript | 255 | ```yuescript |
| 248 | print BackPack.__name -- mencetak Backpack | 256 | print BackPack.__name -- mencetak Backpack |
| 249 | ``` | 257 | ``` |
| 258 | |||
| 250 | <YueDisplay> | 259 | <YueDisplay> |
| 251 | 260 | ||
| 252 | ```yue | 261 | ```yue |
| @@ -272,6 +281,7 @@ Things\some_func! | |||
| 272 | -- variabel kelas tidak terlihat pada instance | 281 | -- variabel kelas tidak terlihat pada instance |
| 273 | assert Things().some_func == nil | 282 | assert Things().some_func == nil |
| 274 | ``` | 283 | ``` |
| 284 | |||
| 275 | <YueDisplay> | 285 | <YueDisplay> |
| 276 | 286 | ||
| 277 | ```yue | 287 | ```yue |
| @@ -300,6 +310,7 @@ Counter! | |||
| 300 | 310 | ||
| 301 | print Counter.count -- mencetak 2 | 311 | print Counter.count -- mencetak 2 |
| 302 | ``` | 312 | ``` |
| 313 | |||
| 303 | <YueDisplay> | 314 | <YueDisplay> |
| 304 | 315 | ||
| 305 | ```yue | 316 | ```yue |
| @@ -322,6 +333,7 @@ Semantik pemanggilan `@@` mirip dengan `@`. Memanggil nama `@@` akan meneruskan | |||
| 322 | ```yuescript | 333 | ```yuescript |
| 323 | @@hello 1,2,3,4 | 334 | @@hello 1,2,3,4 |
| 324 | ``` | 335 | ``` |
| 336 | |||
| 325 | <YueDisplay> | 337 | <YueDisplay> |
| 326 | 338 | ||
| 327 | ```yue | 339 | ```yue |
| @@ -340,6 +352,7 @@ Berikut cara alternatif untuk membuat variabel kelas dibandingkan yang dijelaska | |||
| 340 | class Things | 352 | class Things |
| 341 | @class_var = "hello world" | 353 | @class_var = "hello world" |
| 342 | ``` | 354 | ``` |
| 355 | |||
| 343 | <YueDisplay> | 356 | <YueDisplay> |
| 344 | 357 | ||
| 345 | ```yue | 358 | ```yue |
| @@ -361,6 +374,7 @@ class MoreThings | |||
| 361 | some_method: => | 374 | some_method: => |
| 362 | log "hello world: " .. secret | 375 | log "hello world: " .. secret |
| 363 | ``` | 376 | ``` |
| 377 | |||
| 364 | <YueDisplay> | 378 | <YueDisplay> |
| 365 | 379 | ||
| 366 | ```yue | 380 | ```yue |
| @@ -384,6 +398,7 @@ Jika digunakan sendirian, keduanya adalah alias untuk `self` dan `self.__class`. | |||
| 384 | assert @ == self | 398 | assert @ == self |
| 385 | assert @@ == self.__class | 399 | assert @@ == self.__class |
| 386 | ``` | 400 | ``` |
| 401 | |||
| 387 | <YueDisplay> | 402 | <YueDisplay> |
| 388 | 403 | ||
| 389 | ```yue | 404 | ```yue |
| @@ -398,6 +413,7 @@ Contohnya, cara cepat untuk membuat instance baru dari kelas yang sama dari meth | |||
| 398 | ```yuescript | 413 | ```yuescript |
| 399 | some_instance_method = (...) => @@ ... | 414 | some_instance_method = (...) => @@ ... |
| 400 | ``` | 415 | ``` |
| 416 | |||
| 401 | <YueDisplay> | 417 | <YueDisplay> |
| 402 | 418 | ||
| 403 | ```yue | 419 | ```yue |
| @@ -423,6 +439,7 @@ class Something | |||
| 423 | @@biz = biz | 439 | @@biz = biz |
| 424 | @@baz = baz | 440 | @@baz = baz |
| 425 | ``` | 441 | ``` |
| 442 | |||
| 426 | <YueDisplay> | 443 | <YueDisplay> |
| 427 | 444 | ||
| 428 | ```yue | 445 | ```yue |
| @@ -448,6 +465,7 @@ new = (@fieldA, @fieldB) => @ | |||
| 448 | obj = new {}, 123, "abc" | 465 | obj = new {}, 123, "abc" |
| 449 | print obj | 466 | print obj |
| 450 | ``` | 467 | ``` |
| 468 | |||
| 451 | <YueDisplay> | 469 | <YueDisplay> |
| 452 | 470 | ||
| 453 | ```yue | 471 | ```yue |
| @@ -467,6 +485,7 @@ x = class Bucket | |||
| 467 | drops: 0 | 485 | drops: 0 |
| 468 | add_drop: => @drops += 1 | 486 | add_drop: => @drops += 1 |
| 469 | ``` | 487 | ``` |
| 488 | |||
| 470 | <YueDisplay> | 489 | <YueDisplay> |
| 471 | 490 | ||
| 472 | ```yue | 491 | ```yue |
| @@ -487,6 +506,7 @@ BigBucket = class extends Bucket | |||
| 487 | 506 | ||
| 488 | assert Bucket.__name == "BigBucket" | 507 | assert Bucket.__name == "BigBucket" |
| 489 | ``` | 508 | ``` |
| 509 | |||
| 490 | <YueDisplay> | 510 | <YueDisplay> |
| 491 | 511 | ||
| 492 | ```yue | 512 | ```yue |
| @@ -503,6 +523,7 @@ Anda bahkan bisa menghilangkan badan kelas, artinya Anda bisa menulis kelas anon | |||
| 503 | ```yuescript | 523 | ```yuescript |
| 504 | x = class | 524 | x = class |
| 505 | ``` | 525 | ``` |
| 526 | |||
| 506 | <YueDisplay> | 527 | <YueDisplay> |
| 507 | 528 | ||
| 508 | ```yue | 529 | ```yue |
| @@ -532,6 +553,7 @@ y\func! | |||
| 532 | 553 | ||
| 533 | assert y.__class.__parent ~= X -- X bukan parent dari Y | 554 | assert y.__class.__parent ~= X -- X bukan parent dari Y |
| 534 | ``` | 555 | ``` |
| 556 | |||
| 535 | <YueDisplay> | 557 | <YueDisplay> |
| 536 | 558 | ||
| 537 | ```yue | 559 | ```yue |
diff --git a/doc/docs/id-id/doc/objects/with-statement.md b/doc/docs/id-id/doc/objects/with-statement.md index 3c0a8a5..96a3efd 100644 --- a/doc/docs/id-id/doc/objects/with-statement.md +++ b/doc/docs/id-id/doc/objects/with-statement.md | |||
| @@ -15,6 +15,7 @@ with Person! | |||
| 15 | \save! | 15 | \save! |
| 16 | print .name | 16 | print .name |
| 17 | ``` | 17 | ``` |
| 18 | |||
| 18 | <YueDisplay> | 19 | <YueDisplay> |
| 19 | 20 | ||
| 20 | ```yue | 21 | ```yue |
| @@ -33,6 +34,7 @@ Pernyataan `with` juga bisa digunakan sebagai ekspresi yang mengembalikan nilai | |||
| 33 | file = with File "favorite_foods.txt" | 34 | file = with File "favorite_foods.txt" |
| 34 | \set_encoding "utf8" | 35 | \set_encoding "utf8" |
| 35 | ``` | 36 | ``` |
| 37 | |||
| 36 | <YueDisplay> | 38 | <YueDisplay> |
| 37 | 39 | ||
| 38 | ```yue | 40 | ```yue |
| @@ -52,6 +54,7 @@ create_person = (name, relatives) -> | |||
| 52 | 54 | ||
| 53 | me = create_person "Leaf", [dad, mother, sister] | 55 | me = create_person "Leaf", [dad, mother, sister] |
| 54 | ``` | 56 | ``` |
| 57 | |||
| 55 | <YueDisplay> | 58 | <YueDisplay> |
| 56 | 59 | ||
| 57 | ```yue | 60 | ```yue |
| @@ -74,6 +77,7 @@ with str := "Hello" | |||
| 74 | print "original:", str | 77 | print "original:", str |
| 75 | print "upper:", \upper! | 78 | print "upper:", \upper! |
| 76 | ``` | 79 | ``` |
| 80 | |||
| 77 | <YueDisplay> | 81 | <YueDisplay> |
| 78 | 82 | ||
| 79 | ```yue | 83 | ```yue |
| @@ -95,6 +99,7 @@ with tb | |||
| 95 | ["key-name"] = value | 99 | ["key-name"] = value |
| 96 | [] = "abc" -- menambahkan ke "tb" | 100 | [] = "abc" -- menambahkan ke "tb" |
| 97 | ``` | 101 | ``` |
| 102 | |||
| 98 | <YueDisplay> | 103 | <YueDisplay> |
| 99 | 104 | ||
| 100 | ```yue | 105 | ```yue |
| @@ -115,6 +120,7 @@ with tb | |||
| 115 | with? obj | 120 | with? obj |
| 116 | print obj.name | 121 | print obj.name |
| 117 | ``` | 122 | ``` |
| 123 | |||
| 118 | <YueDisplay> | 124 | <YueDisplay> |
| 119 | 125 | ||
| 120 | ```yue | 126 | ```yue |
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 0a398a5..3adfe63 100644 --- a/doc/docs/id-id/doc/reference/the-yuescript-library.md +++ b/doc/docs/id-id/doc/reference/the-yuescript-library.md | |||
| @@ -17,6 +17,7 @@ Pustaka bahasa YueScript. | |||
| 17 | Versi YueScript. | 17 | Versi YueScript. |
| 18 | 18 | ||
| 19 | **Signature:** | 19 | **Signature:** |
| 20 | |||
| 20 | ```lua | 21 | ```lua |
| 21 | version: string | 22 | version: string |
| 22 | ``` | 23 | ``` |
| @@ -30,6 +31,7 @@ version: string | |||
| 30 | Pemisah file untuk platform saat ini. | 31 | Pemisah file untuk platform saat ini. |
| 31 | 32 | ||
| 32 | **Signature:** | 33 | **Signature:** |
| 34 | |||
| 33 | ```lua | 35 | ```lua |
| 34 | dirsep: string | 36 | dirsep: string |
| 35 | ``` | 37 | ``` |
| @@ -43,6 +45,7 @@ dirsep: string | |||
| 43 | Cache kode modul yang telah dikompilasi. | 45 | Cache kode modul yang telah dikompilasi. |
| 44 | 46 | ||
| 45 | **Signature:** | 47 | **Signature:** |
| 48 | |||
| 46 | ```lua | 49 | ```lua |
| 47 | yue_compiled: {string: string} | 50 | yue_compiled: {string: string} |
| 48 | ``` | 51 | ``` |
| @@ -56,6 +59,7 @@ yue_compiled: {string: string} | |||
| 56 | Fungsi kompilasi YueScript. Mengompilasi kode YueScript menjadi kode Lua. | 59 | Fungsi kompilasi YueScript. Mengompilasi kode YueScript menjadi kode Lua. |
| 57 | 60 | ||
| 58 | **Signature:** | 61 | **Signature:** |
| 62 | |||
| 59 | ```lua | 63 | ```lua |
| 60 | to_lua: function(code: string, config?: Config): | 64 | to_lua: function(code: string, config?: Config): |
| 61 | --[[codes]] string | nil, | 65 | --[[codes]] string | nil, |
| @@ -65,17 +69,17 @@ to_lua: function(code: string, config?: Config): | |||
| 65 | 69 | ||
| 66 | **Parameter:** | 70 | **Parameter:** |
| 67 | 71 | ||
| 68 | | Parameter | Tipe | Deskripsi | | 72 | | Parameter | Tipe | Deskripsi | |
| 69 | | --- | --- | --- | | 73 | | --------- | ------ | ------------------------- | |
| 70 | | code | string | Kode YueScript. | | 74 | | code | string | Kode YueScript. | |
| 71 | | config | Config | [Opsional] Opsi kompiler. | | 75 | | config | Config | [Opsional] Opsi kompiler. | |
| 72 | 76 | ||
| 73 | **Return:** | 77 | **Return:** |
| 74 | 78 | ||
| 75 | | Tipe Return | Deskripsi | | 79 | | Tipe Return | Deskripsi | |
| 76 | | --- | --- | | 80 | | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | |
| 77 | | string \| nil | Kode Lua hasil kompilasi, atau nil jika kompilasi gagal. | | 81 | | string \| nil | Kode Lua hasil kompilasi, atau nil jika kompilasi gagal. | |
| 78 | | string \| nil | Pesan error, atau nil jika kompilasi berhasil. | | 82 | | string \| nil | Pesan error, atau nil jika kompilasi berhasil. | |
| 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. | | 83 | | {{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 | 84 | ||
| 81 | ### file_exist | 85 | ### file_exist |
| @@ -87,21 +91,22 @@ to_lua: function(code: string, config?: Config): | |||
| 87 | Fungsi untuk memeriksa keberadaan file sumber. Dapat ditimpa untuk menyesuaikan perilaku. | 91 | Fungsi untuk memeriksa keberadaan file sumber. Dapat ditimpa untuk menyesuaikan perilaku. |
| 88 | 92 | ||
| 89 | **Signature:** | 93 | **Signature:** |
| 94 | |||
| 90 | ```lua | 95 | ```lua |
| 91 | file_exist: function(filename: string): boolean | 96 | file_exist: function(filename: string): boolean |
| 92 | ``` | 97 | ``` |
| 93 | 98 | ||
| 94 | **Parameter:** | 99 | **Parameter:** |
| 95 | 100 | ||
| 96 | | Parameter | Tipe | Deskripsi | | 101 | | Parameter | Tipe | Deskripsi | |
| 97 | | --- | --- | --- | | 102 | | --------- | ------ | ---------- | |
| 98 | | filename | string | Nama file. | | 103 | | filename | string | Nama file. | |
| 99 | 104 | ||
| 100 | **Return:** | 105 | **Return:** |
| 101 | 106 | ||
| 102 | | Tipe Return | Deskripsi | | 107 | | Tipe Return | Deskripsi | |
| 103 | | --- | --- | | 108 | | ----------- | ---------------- | |
| 104 | | boolean | Apakah file ada. | | 109 | | boolean | Apakah file ada. | |
| 105 | 110 | ||
| 106 | ### read_file | 111 | ### read_file |
| 107 | 112 | ||
| @@ -112,21 +117,22 @@ file_exist: function(filename: string): boolean | |||
| 112 | Fungsi untuk membaca file sumber. Dapat ditimpa untuk menyesuaikan perilaku. | 117 | Fungsi untuk membaca file sumber. Dapat ditimpa untuk menyesuaikan perilaku. |
| 113 | 118 | ||
| 114 | **Signature:** | 119 | **Signature:** |
| 120 | |||
| 115 | ```lua | 121 | ```lua |
| 116 | read_file: function(filename: string): string | 122 | read_file: function(filename: string): string |
| 117 | ``` | 123 | ``` |
| 118 | 124 | ||
| 119 | **Parameter:** | 125 | **Parameter:** |
| 120 | 126 | ||
| 121 | | Parameter | Tipe | Deskripsi | | 127 | | Parameter | Tipe | Deskripsi | |
| 122 | | --- | --- | --- | | 128 | | --------- | ------ | ---------- | |
| 123 | | filename | string | Nama file. | | 129 | | filename | string | Nama file. | |
| 124 | 130 | ||
| 125 | **Return:** | 131 | **Return:** |
| 126 | 132 | ||
| 127 | | Tipe Return | Deskripsi | | 133 | | Tipe Return | Deskripsi | |
| 128 | | --- | --- | | 134 | | ----------- | --------- | |
| 129 | | string | Isi file. | | 135 | | string | Isi file. | |
| 130 | 136 | ||
| 131 | ### insert_loader | 137 | ### insert_loader |
| 132 | 138 | ||
| @@ -137,21 +143,22 @@ read_file: function(filename: string): string | |||
| 137 | Menyisipkan loader YueScript ke package loaders (searchers). | 143 | Menyisipkan loader YueScript ke package loaders (searchers). |
| 138 | 144 | ||
| 139 | **Signature:** | 145 | **Signature:** |
| 146 | |||
| 140 | ```lua | 147 | ```lua |
| 141 | insert_loader: function(pos?: integer): boolean | 148 | insert_loader: function(pos?: integer): boolean |
| 142 | ``` | 149 | ``` |
| 143 | 150 | ||
| 144 | **Parameter:** | 151 | **Parameter:** |
| 145 | 152 | ||
| 146 | | Parameter | Tipe | Deskripsi | | 153 | | Parameter | Tipe | Deskripsi | |
| 147 | | --- | --- | --- | | 154 | | --------- | ------- | ------------------------------------------------------------- | |
| 148 | | pos | integer | [Opsional] Posisi untuk menyisipkan loader. Default adalah 3. | | 155 | | pos | integer | [Opsional] Posisi untuk menyisipkan loader. Default adalah 3. | |
| 149 | 156 | ||
| 150 | **Return:** | 157 | **Return:** |
| 151 | 158 | ||
| 152 | | Tipe Return | Deskripsi | | 159 | | Tipe Return | Deskripsi | |
| 153 | | --- | --- | | 160 | | ----------- | --------------------------------------------------------------------------- | |
| 154 | | boolean | Apakah loader berhasil disisipkan. Akan gagal jika loader sudah disisipkan. | | 161 | | boolean | Apakah loader berhasil disisipkan. Akan gagal jika loader sudah disisipkan. | |
| 155 | 162 | ||
| 156 | ### remove_loader | 163 | ### remove_loader |
| 157 | 164 | ||
| @@ -162,15 +169,16 @@ insert_loader: function(pos?: integer): boolean | |||
| 162 | Menghapus loader YueScript dari package loaders (searchers). | 169 | Menghapus loader YueScript dari package loaders (searchers). |
| 163 | 170 | ||
| 164 | **Signature:** | 171 | **Signature:** |
| 172 | |||
| 165 | ```lua | 173 | ```lua |
| 166 | remove_loader: function(): boolean | 174 | remove_loader: function(): boolean |
| 167 | ``` | 175 | ``` |
| 168 | 176 | ||
| 169 | **Return:** | 177 | **Return:** |
| 170 | 178 | ||
| 171 | | Tipe Return | Deskripsi | | 179 | | Tipe Return | Deskripsi | |
| 172 | | --- | --- | | 180 | | ----------- | ------------------------------------------------------------------------ | |
| 173 | | boolean | Apakah loader berhasil dihapus. Akan gagal jika loader belum disisipkan. | | 181 | | boolean | Apakah loader berhasil dihapus. Akan gagal jika loader belum disisipkan. | |
| 174 | 182 | ||
| 175 | ### loadstring | 183 | ### loadstring |
| 176 | 184 | ||
| @@ -181,6 +189,7 @@ remove_loader: function(): boolean | |||
| 181 | Memuat kode YueScript dari string menjadi fungsi. | 189 | Memuat kode YueScript dari string menjadi fungsi. |
| 182 | 190 | ||
| 183 | **Signature:** | 191 | **Signature:** |
| 192 | |||
| 184 | ```lua | 193 | ```lua |
| 185 | loadstring: function(input: string, chunkname: string, env: table, config?: Config): | 194 | loadstring: function(input: string, chunkname: string, env: table, config?: Config): |
| 186 | --[[loaded function]] nil | function(...: any): (any...), | 195 | --[[loaded function]] nil | function(...: any): (any...), |
| @@ -189,19 +198,19 @@ loadstring: function(input: string, chunkname: string, env: table, config?: Conf | |||
| 189 | 198 | ||
| 190 | **Parameter:** | 199 | **Parameter:** |
| 191 | 200 | ||
| 192 | | Parameter | Tipe | Deskripsi | | 201 | | Parameter | Tipe | Deskripsi | |
| 193 | | --- | --- | --- | | 202 | | --------- | ------ | ------------------------- | |
| 194 | | input | string | Kode YueScript. | | 203 | | input | string | Kode YueScript. | |
| 195 | | chunkname | string | Nama chunk kode. | | 204 | | chunkname | string | Nama chunk kode. | |
| 196 | | env | table | Tabel environment. | | 205 | | env | table | Tabel environment. | |
| 197 | | config | Config | [Opsional] Opsi kompiler. | | 206 | | config | Config | [Opsional] Opsi kompiler. | |
| 198 | 207 | ||
| 199 | **Return:** | 208 | **Return:** |
| 200 | 209 | ||
| 201 | | Tipe Return | Deskripsi | | 210 | | Tipe Return | Deskripsi | |
| 202 | | --- | --- | | 211 | | --------------- | ------------------------------------------------- | |
| 203 | | function \| nil | Fungsi yang dimuat, atau nil jika pemuatan gagal. | | 212 | | function \| nil | Fungsi yang dimuat, atau nil jika pemuatan gagal. | |
| 204 | | string \| nil | Pesan error, atau nil jika pemuatan berhasil. | | 213 | | string \| nil | Pesan error, atau nil jika pemuatan berhasil. | |
| 205 | 214 | ||
| 206 | ### loadstring | 215 | ### loadstring |
| 207 | 216 | ||
| @@ -212,6 +221,7 @@ loadstring: function(input: string, chunkname: string, env: table, config?: Conf | |||
| 212 | Memuat kode YueScript dari string menjadi fungsi. | 221 | Memuat kode YueScript dari string menjadi fungsi. |
| 213 | 222 | ||
| 214 | **Signature:** | 223 | **Signature:** |
| 224 | |||
| 215 | ```lua | 225 | ```lua |
| 216 | loadstring: function(input: string, chunkname: string, config?: Config): | 226 | loadstring: function(input: string, chunkname: string, config?: Config): |
| 217 | --[[loaded function]] nil | function(...: any): (any...), | 227 | --[[loaded function]] nil | function(...: any): (any...), |
| @@ -220,18 +230,18 @@ loadstring: function(input: string, chunkname: string, config?: Config): | |||
| 220 | 230 | ||
| 221 | **Parameter:** | 231 | **Parameter:** |
| 222 | 232 | ||
| 223 | | Parameter | Tipe | Deskripsi | | 233 | | Parameter | Tipe | Deskripsi | |
| 224 | | --- | --- | --- | | 234 | | --------- | ------ | ------------------------- | |
| 225 | | input | string | Kode YueScript. | | 235 | | input | string | Kode YueScript. | |
| 226 | | chunkname | string | Nama chunk kode. | | 236 | | chunkname | string | Nama chunk kode. | |
| 227 | | config | Config | [Opsional] Opsi kompiler. | | 237 | | config | Config | [Opsional] Opsi kompiler. | |
| 228 | 238 | ||
| 229 | **Return:** | 239 | **Return:** |
| 230 | 240 | ||
| 231 | | Tipe Return | Deskripsi | | 241 | | Tipe Return | Deskripsi | |
| 232 | | --- | --- | | 242 | | --------------- | ------------------------------------------------- | |
| 233 | | function \| nil | Fungsi yang dimuat, atau nil jika pemuatan gagal. | | 243 | | function \| nil | Fungsi yang dimuat, atau nil jika pemuatan gagal. | |
| 234 | | string \| nil | Pesan error, atau nil jika pemuatan berhasil. | | 244 | | string \| nil | Pesan error, atau nil jika pemuatan berhasil. | |
| 235 | 245 | ||
| 236 | ### loadstring | 246 | ### loadstring |
| 237 | 247 | ||
| @@ -242,6 +252,7 @@ loadstring: function(input: string, chunkname: string, config?: Config): | |||
| 242 | Memuat kode YueScript dari string menjadi fungsi. | 252 | Memuat kode YueScript dari string menjadi fungsi. |
| 243 | 253 | ||
| 244 | **Signature:** | 254 | **Signature:** |
| 255 | |||
| 245 | ```lua | 256 | ```lua |
| 246 | loadstring: function(input: string, config?: Config): | 257 | loadstring: function(input: string, config?: Config): |
| 247 | --[[loaded function]] nil | function(...: any): (any...), | 258 | --[[loaded function]] nil | function(...: any): (any...), |
| @@ -250,17 +261,17 @@ loadstring: function(input: string, config?: Config): | |||
| 250 | 261 | ||
| 251 | **Parameter:** | 262 | **Parameter:** |
| 252 | 263 | ||
| 253 | | Parameter | Tipe | Deskripsi | | 264 | | Parameter | Tipe | Deskripsi | |
| 254 | | --- | --- | --- | | 265 | | --------- | ------ | ------------------------- | |
| 255 | | input | string | Kode YueScript. | | 266 | | input | string | Kode YueScript. | |
| 256 | | config | Config | [Opsional] Opsi kompiler. | | 267 | | config | Config | [Opsional] Opsi kompiler. | |
| 257 | 268 | ||
| 258 | **Return:** | 269 | **Return:** |
| 259 | 270 | ||
| 260 | | Tipe Return | Deskripsi | | 271 | | Tipe Return | Deskripsi | |
| 261 | | --- | --- | | 272 | | --------------- | ------------------------------------------------- | |
| 262 | | function \| nil | Fungsi yang dimuat, atau nil jika pemuatan gagal. | | 273 | | function \| nil | Fungsi yang dimuat, atau nil jika pemuatan gagal. | |
| 263 | | string \| nil | Pesan error, atau nil jika pemuatan berhasil. | | 274 | | string \| nil | Pesan error, atau nil jika pemuatan berhasil. | |
| 264 | 275 | ||
| 265 | ### loadfile | 276 | ### loadfile |
| 266 | 277 | ||
| @@ -271,6 +282,7 @@ loadstring: function(input: string, config?: Config): | |||
| 271 | Memuat kode YueScript dari file menjadi fungsi. | 282 | Memuat kode YueScript dari file menjadi fungsi. |
| 272 | 283 | ||
| 273 | **Signature:** | 284 | **Signature:** |
| 285 | |||
| 274 | ```lua | 286 | ```lua |
| 275 | loadfile: function(filename: string, env: table, config?: Config): | 287 | loadfile: function(filename: string, env: table, config?: Config): |
| 276 | nil | function(...: any): (any...), | 288 | nil | function(...: any): (any...), |
| @@ -279,18 +291,18 @@ loadfile: function(filename: string, env: table, config?: Config): | |||
| 279 | 291 | ||
| 280 | **Parameter:** | 292 | **Parameter:** |
| 281 | 293 | ||
| 282 | | Parameter | Tipe | Deskripsi | | 294 | | Parameter | Tipe | Deskripsi | |
| 283 | | --- | --- | --- | | 295 | | --------- | ------ | ------------------------- | |
| 284 | | filename | string | Nama file. | | 296 | | filename | string | Nama file. | |
| 285 | | env | table | Tabel environment. | | 297 | | env | table | Tabel environment. | |
| 286 | | config | Config | [Opsional] Opsi kompiler. | | 298 | | config | Config | [Opsional] Opsi kompiler. | |
| 287 | 299 | ||
| 288 | **Return:** | 300 | **Return:** |
| 289 | 301 | ||
| 290 | | Tipe Return | Deskripsi | | 302 | | Tipe Return | Deskripsi | |
| 291 | | --- | --- | | 303 | | --------------- | ------------------------------------------------- | |
| 292 | | function \| nil | Fungsi yang dimuat, atau nil jika pemuatan gagal. | | 304 | | function \| nil | Fungsi yang dimuat, atau nil jika pemuatan gagal. | |
| 293 | | string \| nil | Pesan error, atau nil jika pemuatan berhasil. | | 305 | | string \| nil | Pesan error, atau nil jika pemuatan berhasil. | |
| 294 | 306 | ||
| 295 | ### loadfile | 307 | ### loadfile |
| 296 | 308 | ||
| @@ -301,6 +313,7 @@ loadfile: function(filename: string, env: table, config?: Config): | |||
| 301 | Memuat kode YueScript dari file menjadi fungsi. | 313 | Memuat kode YueScript dari file menjadi fungsi. |
| 302 | 314 | ||
| 303 | **Signature:** | 315 | **Signature:** |
| 316 | |||
| 304 | ```lua | 317 | ```lua |
| 305 | loadfile: function(filename: string, config?: Config): | 318 | loadfile: function(filename: string, config?: Config): |
| 306 | nil | function(...: any): (any...), | 319 | nil | function(...: any): (any...), |
| @@ -309,17 +322,17 @@ loadfile: function(filename: string, config?: Config): | |||
| 309 | 322 | ||
| 310 | **Parameter:** | 323 | **Parameter:** |
| 311 | 324 | ||
| 312 | | Parameter | Tipe | Deskripsi | | 325 | | Parameter | Tipe | Deskripsi | |
| 313 | | --- | --- | --- | | 326 | | --------- | ------ | ------------------------- | |
| 314 | | filename | string | Nama file. | | 327 | | filename | string | Nama file. | |
| 315 | | config | Config | [Opsional] Opsi kompiler. | | 328 | | config | Config | [Opsional] Opsi kompiler. | |
| 316 | 329 | ||
| 317 | **Return:** | 330 | **Return:** |
| 318 | 331 | ||
| 319 | | Tipe Return | Deskripsi | | 332 | | Tipe Return | Deskripsi | |
| 320 | | --- | --- | | 333 | | --------------- | ------------------------------------------------- | |
| 321 | | function \| nil | Fungsi yang dimuat, atau nil jika pemuatan gagal. | | 334 | | function \| nil | Fungsi yang dimuat, atau nil jika pemuatan gagal. | |
| 322 | | string \| nil | Pesan error, atau nil jika pemuatan berhasil. | | 335 | | string \| nil | Pesan error, atau nil jika pemuatan berhasil. | |
| 323 | 336 | ||
| 324 | ### dofile | 337 | ### dofile |
| 325 | 338 | ||
| @@ -330,23 +343,24 @@ loadfile: function(filename: string, config?: Config): | |||
| 330 | Memuat kode YueScript dari file menjadi fungsi dan mengeksekusinya. | 343 | Memuat kode YueScript dari file menjadi fungsi dan mengeksekusinya. |
| 331 | 344 | ||
| 332 | **Signature:** | 345 | **Signature:** |
| 346 | |||
| 333 | ```lua | 347 | ```lua |
| 334 | dofile: function(filename: string, env: table, config?: Config): any... | 348 | dofile: function(filename: string, env: table, config?: Config): any... |
| 335 | ``` | 349 | ``` |
| 336 | 350 | ||
| 337 | **Parameter:** | 351 | **Parameter:** |
| 338 | 352 | ||
| 339 | | Parameter | Tipe | Deskripsi | | 353 | | Parameter | Tipe | Deskripsi | |
| 340 | | --- | --- | --- | | 354 | | --------- | ------ | ------------------------- | |
| 341 | | filename | string | Nama file. | | 355 | | filename | string | Nama file. | |
| 342 | | env | table | Tabel environment. | | 356 | | env | table | Tabel environment. | |
| 343 | | config | Config | [Opsional] Opsi kompiler. | | 357 | | config | Config | [Opsional] Opsi kompiler. | |
| 344 | 358 | ||
| 345 | **Return:** | 359 | **Return:** |
| 346 | 360 | ||
| 347 | | Tipe Return | Deskripsi | | 361 | | Tipe Return | Deskripsi | |
| 348 | | --- | --- | | 362 | | ----------- | ------------------------------------- | |
| 349 | | any... | Nilai return dari fungsi yang dimuat. | | 363 | | any... | Nilai return dari fungsi yang dimuat. | |
| 350 | 364 | ||
| 351 | ### dofile | 365 | ### dofile |
| 352 | 366 | ||
| @@ -357,22 +371,23 @@ dofile: function(filename: string, env: table, config?: Config): any... | |||
| 357 | Memuat kode YueScript dari file menjadi fungsi dan mengeksekusinya. | 371 | Memuat kode YueScript dari file menjadi fungsi dan mengeksekusinya. |
| 358 | 372 | ||
| 359 | **Signature:** | 373 | **Signature:** |
| 374 | |||
| 360 | ```lua | 375 | ```lua |
| 361 | dofile: function(filename: string, config?: Config): any... | 376 | dofile: function(filename: string, config?: Config): any... |
| 362 | ``` | 377 | ``` |
| 363 | 378 | ||
| 364 | **Parameter:** | 379 | **Parameter:** |
| 365 | 380 | ||
| 366 | | Parameter | Tipe | Deskripsi | | 381 | | Parameter | Tipe | Deskripsi | |
| 367 | | --- | --- | --- | | 382 | | --------- | ------ | ------------------------- | |
| 368 | | filename | string | Nama file. | | 383 | | filename | string | Nama file. | |
| 369 | | config | Config | [Opsional] Opsi kompiler. | | 384 | | config | Config | [Opsional] Opsi kompiler. | |
| 370 | 385 | ||
| 371 | **Return:** | 386 | **Return:** |
| 372 | 387 | ||
| 373 | | Tipe Return | Deskripsi | | 388 | | Tipe Return | Deskripsi | |
| 374 | | --- | --- | | 389 | | ----------- | ------------------------------------- | |
| 375 | | any... | Nilai return dari fungsi yang dimuat. | | 390 | | any... | Nilai return dari fungsi yang dimuat. | |
| 376 | 391 | ||
| 377 | ### find_modulepath | 392 | ### find_modulepath |
| 378 | 393 | ||
| @@ -383,21 +398,22 @@ dofile: function(filename: string, config?: Config): any... | |||
| 383 | Menguraikan nama modul YueScript menjadi path file. | 398 | Menguraikan nama modul YueScript menjadi path file. |
| 384 | 399 | ||
| 385 | **Signature:** | 400 | **Signature:** |
| 401 | |||
| 386 | ```lua | 402 | ```lua |
| 387 | find_modulepath: function(name: string): string | 403 | find_modulepath: function(name: string): string |
| 388 | ``` | 404 | ``` |
| 389 | 405 | ||
| 390 | **Parameter:** | 406 | **Parameter:** |
| 391 | 407 | ||
| 392 | | Parameter | Tipe | Deskripsi | | 408 | | Parameter | Tipe | Deskripsi | |
| 393 | | --- | --- | --- | | 409 | | --------- | ------ | ----------- | |
| 394 | | name | string | Nama modul. | | 410 | | name | string | Nama modul. | |
| 395 | 411 | ||
| 396 | **Return:** | 412 | **Return:** |
| 397 | 413 | ||
| 398 | | Tipe Return | Deskripsi | | 414 | | Tipe Return | Deskripsi | |
| 399 | | --- | --- | | 415 | | ----------- | ---------- | |
| 400 | | string | Path file. | | 416 | | string | Path file. | |
| 401 | 417 | ||
| 402 | ### pcall | 418 | ### pcall |
| 403 | 419 | ||
| @@ -410,21 +426,22 @@ Menangkap error apa pun dan mengembalikan kode status beserta hasil atau objek e | |||
| 410 | Menulis ulang nomor baris error ke nomor baris asli di kode YueScript saat error terjadi. | 426 | Menulis ulang nomor baris error ke nomor baris asli di kode YueScript saat error terjadi. |
| 411 | 427 | ||
| 412 | **Signature:** | 428 | **Signature:** |
| 429 | |||
| 413 | ```lua | 430 | ```lua |
| 414 | pcall: function(f: function, ...: any): boolean, any... | 431 | pcall: function(f: function, ...: any): boolean, any... |
| 415 | ``` | 432 | ``` |
| 416 | 433 | ||
| 417 | **Parameter:** | 434 | **Parameter:** |
| 418 | 435 | ||
| 419 | | Parameter | Tipe | Deskripsi | | 436 | | Parameter | Tipe | Deskripsi | |
| 420 | | --- | --- | --- | | 437 | | --------- | -------- | ---------------------------------- | |
| 421 | | f | function | Fungsi yang akan dipanggil. | | 438 | | f | function | Fungsi yang akan dipanggil. | |
| 422 | | ... | any | Argumen yang diteruskan ke fungsi. | | 439 | | ... | any | Argumen yang diteruskan ke fungsi. | |
| 423 | 440 | ||
| 424 | **Return:** | 441 | **Return:** |
| 425 | 442 | ||
| 426 | | Tipe Return | Deskripsi | | 443 | | Tipe Return | Deskripsi | |
| 427 | | --- | --- | | 444 | | ------------ | ---------------------------------------------- | |
| 428 | | boolean, ... | Kode status dan hasil fungsi atau objek error. | | 445 | | boolean, ... | Kode status dan hasil fungsi atau objek error. | |
| 429 | 446 | ||
| 430 | ### require | 447 | ### require |
| @@ -437,21 +454,22 @@ Memuat modul tertentu. Bisa berupa modul Lua atau modul YueScript. | |||
| 437 | Menulis ulang nomor baris error ke nomor baris asli di kode YueScript jika modul adalah modul YueScript dan pemuatan gagal. | 454 | Menulis ulang nomor baris error ke nomor baris asli di kode YueScript jika modul adalah modul YueScript dan pemuatan gagal. |
| 438 | 455 | ||
| 439 | **Signature:** | 456 | **Signature:** |
| 457 | |||
| 440 | ```lua | 458 | ```lua |
| 441 | require: function(name: string): any... | 459 | require: function(name: string): any... |
| 442 | ``` | 460 | ``` |
| 443 | 461 | ||
| 444 | **Parameter:** | 462 | **Parameter:** |
| 445 | 463 | ||
| 446 | | Parameter | Tipe | Deskripsi | | 464 | | Parameter | Tipe | Deskripsi | |
| 447 | | --- | --- | --- | | 465 | | --------- | ------ | ---------------------------- | |
| 448 | | modname | string | Nama modul yang akan dimuat. | | 466 | | modname | string | Nama modul yang akan dimuat. | |
| 449 | 467 | ||
| 450 | **Return:** | 468 | **Return:** |
| 451 | 469 | ||
| 452 | | Tipe Return | Deskripsi | | 470 | | Tipe Return | Deskripsi | |
| 453 | | --- | --- | | 471 | | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 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. | | 472 | | 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 | 473 | ||
| 456 | ### p | 474 | ### p |
| 457 | 475 | ||
| @@ -462,15 +480,16 @@ require: function(name: string): any... | |||
| 462 | Memeriksa struktur nilai yang diteruskan dan mencetak representasi string. | 480 | Memeriksa struktur nilai yang diteruskan dan mencetak representasi string. |
| 463 | 481 | ||
| 464 | **Signature:** | 482 | **Signature:** |
| 483 | |||
| 465 | ```lua | 484 | ```lua |
| 466 | p: function(...: any) | 485 | p: function(...: any) |
| 467 | ``` | 486 | ``` |
| 468 | 487 | ||
| 469 | **Parameter:** | 488 | **Parameter:** |
| 470 | 489 | ||
| 471 | | Parameter | Tipe | Deskripsi | | 490 | | Parameter | Tipe | Deskripsi | |
| 472 | | --- | --- | --- | | 491 | | --------- | ---- | -------------------------- | |
| 473 | | ... | any | Nilai yang akan diperiksa. | | 492 | | ... | any | Nilai yang akan diperiksa. | |
| 474 | 493 | ||
| 475 | ### options | 494 | ### options |
| 476 | 495 | ||
| @@ -481,6 +500,7 @@ p: function(...: any) | |||
| 481 | Opsi kompiler saat ini. | 500 | Opsi kompiler saat ini. |
| 482 | 501 | ||
| 483 | **Signature:** | 502 | **Signature:** |
| 503 | |||
| 484 | ```lua | 504 | ```lua |
| 485 | options: Config.Options | 505 | options: Config.Options |
| 486 | ``` | 506 | ``` |
| @@ -494,21 +514,22 @@ options: Config.Options | |||
| 494 | Fungsi traceback yang menulis ulang nomor baris stack trace ke nomor baris asli di kode YueScript. | 514 | Fungsi traceback yang menulis ulang nomor baris stack trace ke nomor baris asli di kode YueScript. |
| 495 | 515 | ||
| 496 | **Signature:** | 516 | **Signature:** |
| 517 | |||
| 497 | ```lua | 518 | ```lua |
| 498 | traceback: function(message: string): string | 519 | traceback: function(message: string): string |
| 499 | ``` | 520 | ``` |
| 500 | 521 | ||
| 501 | **Parameter:** | 522 | **Parameter:** |
| 502 | 523 | ||
| 503 | | Parameter | Tipe | Deskripsi | | 524 | | Parameter | Tipe | Deskripsi | |
| 504 | | --- | --- | --- | | 525 | | --------- | ------ | ---------------- | |
| 505 | | message | string | Pesan traceback. | | 526 | | message | string | Pesan traceback. | |
| 506 | 527 | ||
| 507 | **Return:** | 528 | **Return:** |
| 508 | 529 | ||
| 509 | | Tipe Return | Deskripsi | | 530 | | Tipe Return | Deskripsi | |
| 510 | | --- | --- | | 531 | | ----------- | ----------------------------------------- | |
| 511 | | string | Pesan traceback yang telah ditulis ulang. | | 532 | | string | Pesan traceback yang telah ditulis ulang. | |
| 512 | 533 | ||
| 513 | ### is_ast | 534 | ### is_ast |
| 514 | 535 | ||
| @@ -519,22 +540,23 @@ traceback: function(message: string): string | |||
| 519 | Memeriksa apakah kode cocok dengan AST yang ditentukan. | 540 | Memeriksa apakah kode cocok dengan AST yang ditentukan. |
| 520 | 541 | ||
| 521 | **Signature:** | 542 | **Signature:** |
| 543 | |||
| 522 | ```lua | 544 | ```lua |
| 523 | is_ast: function(astName: string, code: string): boolean | 545 | is_ast: function(astName: string, code: string): boolean |
| 524 | ``` | 546 | ``` |
| 525 | 547 | ||
| 526 | **Parameter:** | 548 | **Parameter:** |
| 527 | 549 | ||
| 528 | | Parameter | Tipe | Deskripsi | | 550 | | Parameter | Tipe | Deskripsi | |
| 529 | | --- | --- | --- | | 551 | | --------- | ------ | --------- | |
| 530 | | astName | string | Nama AST. | | 552 | | astName | string | Nama AST. | |
| 531 | | code | string | Kode. | | 553 | | code | string | Kode. | |
| 532 | 554 | ||
| 533 | **Return:** | 555 | **Return:** |
| 534 | 556 | ||
| 535 | | Tipe Return | Deskripsi | | 557 | | Tipe Return | Deskripsi | |
| 536 | | --- | --- | | 558 | | ----------- | ----------------------------- | |
| 537 | | boolean | Apakah kode cocok dengan AST. | | 559 | | boolean | Apakah kode cocok dengan AST. | |
| 538 | 560 | ||
| 539 | ### AST | 561 | ### AST |
| 540 | 562 | ||
| @@ -545,6 +567,7 @@ is_ast: function(astName: string, code: string): boolean | |||
| 545 | Definisi tipe AST dengan nama, baris, kolom, dan sub-node. | 567 | Definisi tipe AST dengan nama, baris, kolom, dan sub-node. |
| 546 | 568 | ||
| 547 | **Signature:** | 569 | **Signature:** |
| 570 | |||
| 548 | ```lua | 571 | ```lua |
| 549 | type AST = {string, integer, integer, any} | 572 | type AST = {string, integer, integer, any} |
| 550 | ``` | 573 | ``` |
| @@ -558,6 +581,7 @@ type AST = {string, integer, integer, any} | |||
| 558 | Mengonversi kode menjadi AST. | 581 | Mengonversi kode menjadi AST. |
| 559 | 582 | ||
| 560 | **Signature:** | 583 | **Signature:** |
| 584 | |||
| 561 | ```lua | 585 | ```lua |
| 562 | to_ast: function(code: string, flattenLevel?: number, astName?: string, reserveComment?: boolean): | 586 | to_ast: function(code: string, flattenLevel?: number, astName?: string, reserveComment?: boolean): |
| 563 | --[[AST]] AST | nil, | 587 | --[[AST]] AST | nil, |
| @@ -566,18 +590,18 @@ to_ast: function(code: string, flattenLevel?: number, astName?: string, reserveC | |||
| 566 | 590 | ||
| 567 | **Parameter:** | 591 | **Parameter:** |
| 568 | 592 | ||
| 569 | | Parameter | Tipe | Deskripsi | | 593 | | Parameter | Tipe | Deskripsi | |
| 570 | | --- | --- | --- | | 594 | | -------------- | ------- | ---------------------------------------------------------------------------------------- | |
| 571 | | code | string | Kode. | | 595 | | code | string | Kode. | |
| 572 | | flattenLevel | integer | [Opsional] Tingkat perataan. Semakin tinggi berarti semakin rata. Default 0. Maksimum 2. | | 596 | | flattenLevel | integer | [Opsional] Tingkat perataan. Semakin tinggi berarti semakin rata. Default 0. Maksimum 2. | |
| 573 | | astName | string | [Opsional] Nama AST. Default "File". | | 597 | | astName | string | [Opsional] Nama AST. Default "File". | |
| 574 | | reserveComment | boolean | [Opsional] Apakah akan mempertahankan komentar asli. Default false. | | 598 | | reserveComment | boolean | [Opsional] Apakah akan mempertahankan komentar asli. Default false. | |
| 575 | 599 | ||
| 576 | **Return:** | 600 | **Return:** |
| 577 | 601 | ||
| 578 | | Tipe Return | Deskripsi | | 602 | | Tipe Return | Deskripsi | |
| 579 | | --- | --- | | 603 | | ------------- | --------------------------------------------- | |
| 580 | | AST \| nil | AST, atau nil jika konversi gagal. | | 604 | | AST \| nil | AST, atau nil jika konversi gagal. | |
| 581 | | string \| nil | Pesan error, atau nil jika konversi berhasil. | | 605 | | string \| nil | Pesan error, atau nil jika konversi berhasil. | |
| 582 | 606 | ||
| 583 | ### format | 607 | ### format |
| @@ -589,25 +613,26 @@ to_ast: function(code: string, flattenLevel?: number, astName?: string, reserveC | |||
| 589 | Memformat kode YueScript. | 613 | Memformat kode YueScript. |
| 590 | 614 | ||
| 591 | **Signature:** | 615 | **Signature:** |
| 616 | |||
| 592 | ```lua | 617 | ```lua |
| 593 | format: function(code: string, tabSize?: number, reserveComment?: boolean): string | 618 | format: function(code: string, tabSize?: number, reserveComment?: boolean): string |
| 594 | ``` | 619 | ``` |
| 595 | 620 | ||
| 596 | **Parameter:** | 621 | **Parameter:** |
| 597 | 622 | ||
| 598 | | Parameter | Tipe | Deskripsi | | 623 | | Parameter | Tipe | Deskripsi | |
| 599 | | --- | --- | --- | | 624 | | -------------- | ------- | ------------------------------------------------------------- | |
| 600 | | code | string | Kode. | | 625 | | code | string | Kode. | |
| 601 | | tabSize | integer | [Opsional] Ukuran tab. Default 4. | | 626 | | tabSize | integer | [Opsional] Ukuran tab. Default 4. | |
| 602 | | reserveComment | boolean | [Opsional] Apakah mempertahankan komentar asli. Default true. | | 627 | | reserveComment | boolean | [Opsional] Apakah mempertahankan komentar asli. Default true. | |
| 603 | 628 | ||
| 604 | **Return:** | 629 | **Return:** |
| 605 | 630 | ||
| 606 | | Tipe Return | Deskripsi | | 631 | | Tipe Return | Deskripsi | |
| 607 | | --- | --- | | 632 | | ----------- | ------------------------- | |
| 608 | | string | Kode yang telah diformat. | | 633 | | string | Kode yang telah diformat. | |
| 609 | 634 | ||
| 610 | ### __call | 635 | ### \_\_call |
| 611 | 636 | ||
| 612 | **Tipe:** Metamethod. | 637 | **Tipe:** Metamethod. |
| 613 | 638 | ||
| @@ -617,21 +642,22 @@ Me-require modul YueScript. | |||
| 617 | Menulis ulang nomor baris error ke nomor baris asli di kode YueScript saat pemuatan gagal. | 642 | Menulis ulang nomor baris error ke nomor baris asli di kode YueScript saat pemuatan gagal. |
| 618 | 643 | ||
| 619 | **Signature:** | 644 | **Signature:** |
| 645 | |||
| 620 | ```lua | 646 | ```lua |
| 621 | metamethod __call: function(self: yue, module: string): any... | 647 | metamethod __call: function(self: yue, module: string): any... |
| 622 | ``` | 648 | ``` |
| 623 | 649 | ||
| 624 | **Parameter:** | 650 | **Parameter:** |
| 625 | 651 | ||
| 626 | | Parameter | Tipe | Deskripsi | | 652 | | Parameter | Tipe | Deskripsi | |
| 627 | | --- | --- | --- | | 653 | | --------- | ------ | ----------- | |
| 628 | | module | string | Nama modul. | | 654 | | module | string | Nama modul. | |
| 629 | 655 | ||
| 630 | **Return:** | 656 | **Return:** |
| 631 | 657 | ||
| 632 | | Tipe Return | Deskripsi | | 658 | | Tipe Return | Deskripsi | |
| 633 | | --- | --- | | 659 | | ----------- | ------------ | |
| 634 | | any | Nilai modul. | | 660 | | any | Nilai modul. | |
| 635 | 661 | ||
| 636 | ## Config | 662 | ## Config |
| 637 | 663 | ||
| @@ -648,6 +674,7 @@ Opsi kompilasi kompiler. | |||
| 648 | Apakah kompiler harus mengumpulkan variabel global yang muncul dalam kode. | 674 | Apakah kompiler harus mengumpulkan variabel global yang muncul dalam kode. |
| 649 | 675 | ||
| 650 | **Signature:** | 676 | **Signature:** |
| 677 | |||
| 651 | ```lua | 678 | ```lua |
| 652 | lint_global: boolean | 679 | lint_global: boolean |
| 653 | ``` | 680 | ``` |
| @@ -661,6 +688,7 @@ lint_global: boolean | |||
| 661 | Apakah kompiler harus melakukan return implisit untuk blok kode root. | 688 | Apakah kompiler harus melakukan return implisit untuk blok kode root. |
| 662 | 689 | ||
| 663 | **Signature:** | 690 | **Signature:** |
| 691 | |||
| 664 | ```lua | 692 | ```lua |
| 665 | implicit_return_root: boolean | 693 | implicit_return_root: boolean |
| 666 | ``` | 694 | ``` |
| @@ -674,6 +702,7 @@ implicit_return_root: boolean | |||
| 674 | Apakah kompiler harus mempertahankan nomor baris asli di kode hasil kompilasi. | 702 | Apakah kompiler harus mempertahankan nomor baris asli di kode hasil kompilasi. |
| 675 | 703 | ||
| 676 | **Signature:** | 704 | **Signature:** |
| 705 | |||
| 677 | ```lua | 706 | ```lua |
| 678 | reserve_line_number: boolean | 707 | reserve_line_number: boolean |
| 679 | ``` | 708 | ``` |
| @@ -687,6 +716,7 @@ reserve_line_number: boolean | |||
| 687 | Apakah kompiler harus mempertahankan komentar asli di kode hasil kompilasi. | 716 | Apakah kompiler harus mempertahankan komentar asli di kode hasil kompilasi. |
| 688 | 717 | ||
| 689 | **Signature:** | 718 | **Signature:** |
| 719 | |||
| 690 | ```lua | 720 | ```lua |
| 691 | reserve_comment: boolean | 721 | reserve_comment: boolean |
| 692 | ``` | 722 | ``` |
| @@ -700,6 +730,7 @@ reserve_comment: boolean | |||
| 700 | Apakah kompiler harus menggunakan karakter spasi alih-alih tab di kode hasil kompilasi. | 730 | Apakah kompiler harus menggunakan karakter spasi alih-alih tab di kode hasil kompilasi. |
| 701 | 731 | ||
| 702 | **Signature:** | 732 | **Signature:** |
| 733 | |||
| 703 | ```lua | 734 | ```lua |
| 704 | space_over_tab: boolean | 735 | space_over_tab: boolean |
| 705 | ``` | 736 | ``` |
| @@ -713,6 +744,7 @@ space_over_tab: boolean | |||
| 713 | Apakah kompiler harus memperlakukan kode yang akan dikompilasi sebagai modul yang sama dengan modul yang sedang dikompilasi. Untuk penggunaan internal saja. | 744 | Apakah kompiler harus memperlakukan kode yang akan dikompilasi sebagai modul yang sama dengan modul yang sedang dikompilasi. Untuk penggunaan internal saja. |
| 714 | 745 | ||
| 715 | **Signature:** | 746 | **Signature:** |
| 747 | |||
| 716 | ```lua | 748 | ```lua |
| 717 | same_module: boolean | 749 | same_module: boolean |
| 718 | ``` | 750 | ``` |
| @@ -726,6 +758,7 @@ same_module: boolean | |||
| 726 | Apakah pesan error kompiler harus menyertakan offset nomor baris. Untuk penggunaan internal saja. | 758 | Apakah pesan error kompiler harus menyertakan offset nomor baris. Untuk penggunaan internal saja. |
| 727 | 759 | ||
| 728 | **Signature:** | 760 | **Signature:** |
| 761 | |||
| 729 | ```lua | 762 | ```lua |
| 730 | line_offset: integer | 763 | line_offset: integer |
| 731 | ``` | 764 | ``` |
| @@ -739,6 +772,7 @@ line_offset: integer | |||
| 739 | Enumerasi versi Lua target. | 772 | Enumerasi versi Lua target. |
| 740 | 773 | ||
| 741 | **Signature:** | 774 | **Signature:** |
| 775 | |||
| 742 | ```lua | 776 | ```lua |
| 743 | enum LuaTarget | 777 | enum LuaTarget |
| 744 | "5.1" | 778 | "5.1" |
| @@ -758,6 +792,7 @@ end | |||
| 758 | Opsi tambahan untuk diteruskan ke fungsi kompilasi. | 792 | Opsi tambahan untuk diteruskan ke fungsi kompilasi. |
| 759 | 793 | ||
| 760 | **Signature:** | 794 | **Signature:** |
| 795 | |||
| 761 | ```lua | 796 | ```lua |
| 762 | options: Options | 797 | options: Options |
| 763 | ``` | 798 | ``` |
| @@ -777,6 +812,7 @@ Definisi opsi kompiler tambahan. | |||
| 777 | Versi Lua target untuk kompilasi. | 812 | Versi Lua target untuk kompilasi. |
| 778 | 813 | ||
| 779 | **Signature:** | 814 | **Signature:** |
| 815 | |||
| 780 | ```lua | 816 | ```lua |
| 781 | target: LuaTarget | 817 | target: LuaTarget |
| 782 | ``` | 818 | ``` |
| @@ -790,6 +826,7 @@ target: LuaTarget | |||
| 790 | Path pencarian modul tambahan. | 826 | Path pencarian modul tambahan. |
| 791 | 827 | ||
| 792 | **Signature:** | 828 | **Signature:** |
| 829 | |||
| 793 | ```lua | 830 | ```lua |
| 794 | path: string | 831 | path: string |
| 795 | ``` | 832 | ``` |
| @@ -803,6 +840,7 @@ path: string | |||
| 803 | Apakah akan menampilkan variabel local dalam pesan error traceback. Default false. | 840 | Apakah akan menampilkan variabel local dalam pesan error traceback. Default false. |
| 804 | 841 | ||
| 805 | **Signature:** | 842 | **Signature:** |
| 843 | |||
| 806 | ```lua | 844 | ```lua |
| 807 | dump_locals: boolean | 845 | dump_locals: boolean |
| 808 | ``` | 846 | ``` |
| @@ -816,6 +854,7 @@ dump_locals: boolean | |||
| 816 | Apakah akan menyederhanakan pesan error. Default true. | 854 | Apakah akan menyederhanakan pesan error. Default true. |
| 817 | 855 | ||
| 818 | **Signature:** | 856 | **Signature:** |
| 857 | |||
| 819 | ```lua | 858 | ```lua |
| 820 | simplified: boolean | 859 | simplified: boolean |
| 821 | ``` | 860 | ``` |
diff --git a/doc/docs/id-id/try/index.md b/doc/docs/id-id/try/index.md index c31dc1c..c5127e2 100755 --- a/doc/docs/id-id/try/index.md +++ b/doc/docs/id-id/try/index.md | |||
| @@ -5,6 +5,7 @@ next: false | |||
| 5 | --- | 5 | --- |
| 6 | 6 | ||
| 7 | # Kompiler Online YueScript | 7 | # Kompiler Online YueScript |
| 8 | |||
| 8 | --- | 9 | --- |
| 9 | 10 | ||
| 10 | Coba YueScript di browser dengan WASM. | 11 | Coba YueScript di browser dengan WASM. |
