From 394ee0f64a0dc022f1dab86213d4771982ecf987 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Sat, 28 Feb 2026 16:52:40 +0800 Subject: Updated docs. --- doc/docs/id-id/doc/language-basics/operator.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'doc/docs/id-id') 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 Anda bisa menggabungkan tabel array atau tabel hash menggunakan operator spread `...` sebelum ekspresi di literal tabel. +Saat melakukan spread ke literal tabel dengan kurung kurawal (misalnya `{...other}`), bagian array dan bagian hash dari tabel Lua akan disalin. + ```yuescript parts = * "shoulders" @@ -176,6 +178,30 @@ merge = {...a, ...b} +### Penyebaran Tabel List + +Saat melakukan spread ke literal tabel dengan kurung siku (misalnya `[...other,]`), hanya bagian array yang disalin. + +```yuescript +source = {1, 2, 3, name: "Yue"} +fullCopy = {...source} +listCopy = [...source,] +-- fullCopy => {1, 2, 3, name: "Yue"} +-- listCopy => [1, 2, 3] +``` + + + +```yue +source = {1, 2, 3, name: "Yue"} +fullCopy = {...source} +listCopy = [...source,] +-- fullCopy => {1, 2, 3, name: "Yue"} +-- listCopy => [1, 2, 3] +``` + + + ## Indeks Balik Tabel Anda dapat menggunakan operator **#** untuk mendapatkan elemen terakhir dari tabel. -- cgit v1.2.3-55-g6feb