diff options
| author | Li Jin <dragon-fly@qq.com> | 2026-02-28 16:52:40 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2026-02-28 16:52:40 +0800 |
| commit | 394ee0f64a0dc022f1dab86213d4771982ecf987 (patch) | |
| tree | 742623d81f4fdd5a2c4998a7735634fcd79ac5e9 /doc/docs | |
| parent | 7555271be61990fd5020eac48fc80d6a24886b9c (diff) | |
| download | yuescript-394ee0f64a0dc022f1dab86213d4771982ecf987.tar.gz yuescript-394ee0f64a0dc022f1dab86213d4771982ecf987.tar.bz2 yuescript-394ee0f64a0dc022f1dab86213d4771982ecf987.zip | |
Updated docs.
Diffstat (limited to 'doc/docs')
| -rw-r--r-- | doc/docs/de/doc/language-basics/operator.md | 26 | ||||
| -rw-r--r-- | doc/docs/doc/language-basics/operator.md | 26 | ||||
| -rw-r--r-- | doc/docs/id-id/doc/language-basics/operator.md | 26 | ||||
| -rw-r--r-- | doc/docs/pt-br/doc/language-basics/operator.md | 26 | ||||
| -rw-r--r-- | doc/docs/zh/doc/language-basics/operator.md | 26 |
5 files changed, 130 insertions, 0 deletions
diff --git a/doc/docs/de/doc/language-basics/operator.md b/doc/docs/de/doc/language-basics/operator.md index 3be5ec8..5deec6a 100644 --- a/doc/docs/de/doc/language-basics/operator.md +++ b/doc/docs/de/doc/language-basics/operator.md | |||
| @@ -138,6 +138,8 @@ tbA[] = ...tbB | |||
| 138 | 138 | ||
| 139 | Du kannst Array-Tabellen oder Hash-Tabellen mit dem Spread-Operator `...` vor Ausdrücken in Tabellenliteralen zusammenführen. | 139 | Du kannst Array-Tabellen oder Hash-Tabellen mit dem Spread-Operator `...` vor Ausdrücken in Tabellenliteralen zusammenführen. |
| 140 | 140 | ||
| 141 | Wenn in ein Tabellenliteral mit geschweiften Klammern gespreadet wird (zum Beispiel `{...other}`), werden sowohl der Array-Teil als auch der Hash-Teil der Lua-Tabelle kopiert. | ||
| 142 | |||
| 141 | ```yuescript | 143 | ```yuescript |
| 142 | parts = | 144 | parts = |
| 143 | * "Schultern" | 145 | * "Schultern" |
| @@ -176,6 +178,30 @@ merge = {...a, ...b} | |||
| 176 | 178 | ||
| 177 | </YueDisplay> | 179 | </YueDisplay> |
| 178 | 180 | ||
| 181 | ### List-Tabellen-Spread | ||
| 182 | |||
| 183 | Wenn in ein Tabellenliteral mit eckigen Klammern gespreadet wird (zum Beispiel `[...other,]`), wird nur der Array-Teil kopiert. | ||
| 184 | |||
| 185 | ```yuescript | ||
| 186 | source = {1, 2, 3, name: "Yue"} | ||
| 187 | fullCopy = {...source} | ||
| 188 | listCopy = [...source,] | ||
| 189 | -- fullCopy => {1, 2, 3, name: "Yue"} | ||
| 190 | -- listCopy => [1, 2, 3] | ||
| 191 | ``` | ||
| 192 | |||
| 193 | <YueDisplay> | ||
| 194 | |||
| 195 | ```yue | ||
| 196 | source = {1, 2, 3, name: "Yue"} | ||
| 197 | fullCopy = {...source} | ||
| 198 | listCopy = [...source,] | ||
| 199 | -- fullCopy => {1, 2, 3, name: "Yue"} | ||
| 200 | -- listCopy => [1, 2, 3] | ||
| 201 | ``` | ||
| 202 | |||
| 203 | </YueDisplay> | ||
| 204 | |||
| 179 | ## Umgekehrter Tabellenindex | 205 | ## Umgekehrter Tabellenindex |
| 180 | 206 | ||
| 181 | Mit dem Operator **#** kannst du auf die letzten Elemente einer Tabelle zugreifen. | 207 | Mit dem Operator **#** kannst du auf die letzten Elemente einer Tabelle zugreifen. |
diff --git a/doc/docs/doc/language-basics/operator.md b/doc/docs/doc/language-basics/operator.md index caeb6f4..067aa66 100644 --- a/doc/docs/doc/language-basics/operator.md +++ b/doc/docs/doc/language-basics/operator.md | |||
| @@ -138,6 +138,8 @@ tbA[] = ...tbB | |||
| 138 | 138 | ||
| 139 | You can concatenate array tables or hash tables using spread operator `...` before expressions in table literals. | 139 | You can concatenate array tables or hash tables using spread operator `...` before expressions in table literals. |
| 140 | 140 | ||
| 141 | When spreading into a brace table literal (for example, `{...other}`), both the array part and hash part of the Lua table are copied. | ||
| 142 | |||
| 141 | ```yuescript | 143 | ```yuescript |
| 142 | parts = | 144 | parts = |
| 143 | * "shoulders" | 145 | * "shoulders" |
| @@ -176,6 +178,30 @@ merge = {...a, ...b} | |||
| 176 | 178 | ||
| 177 | </YueDisplay> | 179 | </YueDisplay> |
| 178 | 180 | ||
| 181 | ### List Table Spreading | ||
| 182 | |||
| 183 | When spreading into a bracket table literal (for example, `[...other,]`), only the array part is copied. | ||
| 184 | |||
| 185 | ```yuescript | ||
| 186 | source = {1, 2, 3, name: "Yue"} | ||
| 187 | fullCopy = {...source} | ||
| 188 | listCopy = [...source,] | ||
| 189 | -- fullCopy => {1, 2, 3, name: "Yue"} | ||
| 190 | -- listCopy => [1, 2, 3] | ||
| 191 | ``` | ||
| 192 | |||
| 193 | <YueDisplay> | ||
| 194 | |||
| 195 | ```yue | ||
| 196 | source = {1, 2, 3, name: "Yue"} | ||
| 197 | fullCopy = {...source} | ||
| 198 | listCopy = [...source,] | ||
| 199 | -- fullCopy => {1, 2, 3, name: "Yue"} | ||
| 200 | -- listCopy => [1, 2, 3] | ||
| 201 | ``` | ||
| 202 | |||
| 203 | </YueDisplay> | ||
| 204 | |||
| 179 | ## Table Reversed Indexing | 205 | ## Table Reversed Indexing |
| 180 | 206 | ||
| 181 | You can use the **#** operator to get the last elements of a table. | 207 | You can use the **#** operator to get the last elements of a table. |
diff --git a/doc/docs/id-id/doc/language-basics/operator.md b/doc/docs/id-id/doc/language-basics/operator.md index b2b1003..68c96e6 100644 --- a/doc/docs/id-id/doc/language-basics/operator.md +++ b/doc/docs/id-id/doc/language-basics/operator.md | |||
| @@ -138,6 +138,8 @@ tbA[] = ...tbB | |||
| 138 | 138 | ||
| 139 | Anda bisa menggabungkan tabel array atau tabel hash menggunakan operator spread `...` sebelum ekspresi di literal tabel. | 139 | Anda bisa menggabungkan tabel array atau tabel hash menggunakan operator spread `...` sebelum ekspresi di literal tabel. |
| 140 | 140 | ||
| 141 | Saat melakukan spread ke literal tabel dengan kurung kurawal (misalnya `{...other}`), bagian array dan bagian hash dari tabel Lua akan disalin. | ||
| 142 | |||
| 141 | ```yuescript | 143 | ```yuescript |
| 142 | parts = | 144 | parts = |
| 143 | * "shoulders" | 145 | * "shoulders" |
| @@ -176,6 +178,30 @@ merge = {...a, ...b} | |||
| 176 | 178 | ||
| 177 | </YueDisplay> | 179 | </YueDisplay> |
| 178 | 180 | ||
| 181 | ### Penyebaran Tabel List | ||
| 182 | |||
| 183 | Saat melakukan spread ke literal tabel dengan kurung siku (misalnya `[...other,]`), hanya bagian array yang disalin. | ||
| 184 | |||
| 185 | ```yuescript | ||
| 186 | source = {1, 2, 3, name: "Yue"} | ||
| 187 | fullCopy = {...source} | ||
| 188 | listCopy = [...source,] | ||
| 189 | -- fullCopy => {1, 2, 3, name: "Yue"} | ||
| 190 | -- listCopy => [1, 2, 3] | ||
| 191 | ``` | ||
| 192 | |||
| 193 | <YueDisplay> | ||
| 194 | |||
| 195 | ```yue | ||
| 196 | source = {1, 2, 3, name: "Yue"} | ||
| 197 | fullCopy = {...source} | ||
| 198 | listCopy = [...source,] | ||
| 199 | -- fullCopy => {1, 2, 3, name: "Yue"} | ||
| 200 | -- listCopy => [1, 2, 3] | ||
| 201 | ``` | ||
| 202 | |||
| 203 | </YueDisplay> | ||
| 204 | |||
| 179 | ## Indeks Balik Tabel | 205 | ## Indeks Balik Tabel |
| 180 | 206 | ||
| 181 | Anda dapat menggunakan operator **#** untuk mendapatkan elemen terakhir dari tabel. | 207 | Anda dapat menggunakan operator **#** untuk mendapatkan elemen terakhir dari tabel. |
diff --git a/doc/docs/pt-br/doc/language-basics/operator.md b/doc/docs/pt-br/doc/language-basics/operator.md index e0c0872..976cb43 100644 --- a/doc/docs/pt-br/doc/language-basics/operator.md +++ b/doc/docs/pt-br/doc/language-basics/operator.md | |||
| @@ -138,6 +138,8 @@ tbA[] = ...tbB | |||
| 138 | 138 | ||
| 139 | Você pode concatenar tabelas de array ou tabelas hash usando o operador spread `...` antes de expressões em literais de tabela. | 139 | Você pode concatenar tabelas de array ou tabelas hash usando o operador spread `...` antes de expressões em literais de tabela. |
| 140 | 140 | ||
| 141 | Ao fazer spread em um literal de tabela com chaves (por exemplo, `{...other}`), tanto a parte de array quanto a parte hash da tabela Lua são copiadas. | ||
| 142 | |||
| 141 | ```yuescript | 143 | ```yuescript |
| 142 | parts = | 144 | parts = |
| 143 | * "shoulders" | 145 | * "shoulders" |
| @@ -176,6 +178,30 @@ merge = {...a, ...b} | |||
| 176 | 178 | ||
| 177 | </YueDisplay> | 179 | </YueDisplay> |
| 178 | 180 | ||
| 181 | ### Spread de tabela de lista | ||
| 182 | |||
| 183 | Ao fazer spread em um literal de tabela com colchetes (por exemplo, `[...other,]`), apenas a parte de array é copiada. | ||
| 184 | |||
| 185 | ```yuescript | ||
| 186 | source = {1, 2, 3, name: "Yue"} | ||
| 187 | fullCopy = {...source} | ||
| 188 | listCopy = [...source,] | ||
| 189 | -- fullCopy => {1, 2, 3, name: "Yue"} | ||
| 190 | -- listCopy => [1, 2, 3] | ||
| 191 | ``` | ||
| 192 | |||
| 193 | <YueDisplay> | ||
| 194 | |||
| 195 | ```yue | ||
| 196 | source = {1, 2, 3, name: "Yue"} | ||
| 197 | fullCopy = {...source} | ||
| 198 | listCopy = [...source,] | ||
| 199 | -- fullCopy => {1, 2, 3, name: "Yue"} | ||
| 200 | -- listCopy => [1, 2, 3] | ||
| 201 | ``` | ||
| 202 | |||
| 203 | </YueDisplay> | ||
| 204 | |||
| 179 | ## Indexação reversa de tabela | 205 | ## Indexação reversa de tabela |
| 180 | 206 | ||
| 181 | Você pode usar o operador **#** para obter os últimos elementos de uma tabela. | 207 | Você pode usar o operador **#** para obter os últimos elementos de uma tabela. |
diff --git a/doc/docs/zh/doc/language-basics/operator.md b/doc/docs/zh/doc/language-basics/operator.md index fc2a49d..6e3721f 100644 --- a/doc/docs/zh/doc/language-basics/operator.md +++ b/doc/docs/zh/doc/language-basics/operator.md | |||
| @@ -138,6 +138,8 @@ tbA[] = ...tbB | |||
| 138 | 138 | ||
| 139 |   你可以使用前置 `...` 操作符在 Lua 表中插入数组表或哈希表。 | 139 |   你可以使用前置 `...` 操作符在 Lua 表中插入数组表或哈希表。 |
| 140 | 140 | ||
| 141 |   使用花括号字面量做表扩展(例如 `{...other}`)时,会复制 Lua 表中的数组部分和哈希部分。 | ||
| 142 | |||
| 141 | ```yuescript | 143 | ```yuescript |
| 142 | parts = | 144 | parts = |
| 143 | * "shoulders" | 145 | * "shoulders" |
| @@ -176,6 +178,30 @@ merge = {...a, ...b} | |||
| 176 | 178 | ||
| 177 | </YueDisplay> | 179 | </YueDisplay> |
| 178 | 180 | ||
| 181 | ### 列表表扩展 | ||
| 182 | |||
| 183 |   使用中括号字面量做表扩展(例如 `[...other,]`)时,只会复制 Lua 表中的数组部分。 | ||
| 184 | |||
| 185 | ```yuescript | ||
| 186 | source = {1, 2, 3, name: "Yue"} | ||
| 187 | fullCopy = {...source} | ||
| 188 | listCopy = [...source,] | ||
| 189 | -- fullCopy => {1, 2, 3, name: "Yue"} | ||
| 190 | -- listCopy => [1, 2, 3] | ||
| 191 | ``` | ||
| 192 | |||
| 193 | <YueDisplay> | ||
| 194 | |||
| 195 | ```yue | ||
| 196 | source = {1, 2, 3, name: "Yue"} | ||
| 197 | fullCopy = {...source} | ||
| 198 | listCopy = [...source,] | ||
| 199 | -- fullCopy => {1, 2, 3, name: "Yue"} | ||
| 200 | -- listCopy => [1, 2, 3] | ||
| 201 | ``` | ||
| 202 | |||
| 203 | </YueDisplay> | ||
| 204 | |||
| 179 | ## 表反向索引 | 205 | ## 表反向索引 |
| 180 | 206 | ||
| 181 |   你可以使用 **#** 操作符来反向索引表中的元素。 | 207 |   你可以使用 **#** 操作符来反向索引表中的元素。 |
