Skip to content

Commit 29db607

Browse files
committed
Fixed destructuring with empty and comment lines in table issue. Updated docs.
1 parent 394ee0f commit 29db607

18 files changed

Lines changed: 475 additions & 1 deletion

doc/docs/de/doc/objects/object-oriented-programming.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,28 @@ Beachte, dass alle Methoden in der Klasse die Fat-Arrow-Syntax verwenden. Beim A
4040

4141
Das `@`-Präfix ist Kurzform für `self.`. `@items` wird zu `self.items`.
4242

43+
Der Klassenblock unterstützt auch Metatable-Felder, indem Metamethod-Schlüssel in spitzen Klammern geschrieben werden, zum Beispiel `<tostring>`.
44+
45+
```yuescript
46+
class User
47+
new: (@name) =>
48+
<tostring>: => "User(#{@name})"
49+
50+
print tostring User "Yue"
51+
```
52+
53+
<YueDisplay>
54+
55+
```yue
56+
class User
57+
new: (@name) =>
58+
<tostring>: => "User(#{@name})"
59+
60+
print tostring User "Yue"
61+
```
62+
63+
</YueDisplay>
64+
4365
Eine Instanz der Klasse wird erstellt, indem man den Klassennamen wie eine Funktion aufruft.
4466

4567
```yuescript

doc/docs/doc/objects/object-oriented-programming.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,28 @@ Notice how all the methods in the class use the fat arrow function syntax. When
4040

4141
The @ prefix on a variable name is shorthand for self.. @items becomes self.items.
4242

43+
The class block also supports metatable fields by writing metamethod keys in angle brackets, such as `<tostring>`.
44+
45+
```yuescript
46+
class User
47+
new: (@name) =>
48+
<tostring>: => "User(#{@name})"
49+
50+
print tostring User "Yue"
51+
```
52+
53+
<YueDisplay>
54+
55+
```yue
56+
class User
57+
new: (@name) =>
58+
<tostring>: => "User(#{@name})"
59+
60+
print tostring User "Yue"
61+
```
62+
63+
</YueDisplay>
64+
4365
Creating an instance of the class is done by calling the name of the class as a function.
4466

4567
```yuescript

doc/docs/id-id/doc/objects/object-oriented-programming.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,28 @@ Perhatikan bahwa semua method di kelas menggunakan sintaks fungsi panah tebal. S
4040

4141
Prefiks `@` pada nama variabel adalah singkatan untuk `self.`. `@items` menjadi `self.items`.
4242

43+
Blok kelas juga mendukung field metatable dengan menulis key metamethod dalam tanda kurung sudut, misalnya `<tostring>`.
44+
45+
```yuescript
46+
class User
47+
new: (@name) =>
48+
<tostring>: => "User(#{@name})"
49+
50+
print tostring User "Yue"
51+
```
52+
53+
<YueDisplay>
54+
55+
```yue
56+
class User
57+
new: (@name) =>
58+
<tostring>: => "User(#{@name})"
59+
60+
print tostring User "Yue"
61+
```
62+
63+
</YueDisplay>
64+
4365
Membuat instance kelas dilakukan dengan memanggil nama kelas sebagai fungsi.
4466

4567
```yuescript

doc/docs/pt-br/doc/objects/object-oriented-programming.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,28 @@ Observe como todos os métodos da classe usam a sintaxe de função seta fat. Ao
4040

4141
O prefixo @ em um nome de variável é abreviação para self.. @items torna-se self.items.
4242

43+
O bloco da classe também suporta campos de metatable escrevendo chaves de metamétodo entre `<>`, como `<tostring>`.
44+
45+
```yuescript
46+
class User
47+
new: (@name) =>
48+
<tostring>: => "User(#{@name})"
49+
50+
print tostring User "Yue"
51+
```
52+
53+
<YueDisplay>
54+
55+
```yue
56+
class User
57+
new: (@name) =>
58+
<tostring>: => "User(#{@name})"
59+
60+
print tostring User "Yue"
61+
```
62+
63+
</YueDisplay>
64+
4365
Criar uma instância da classe é feito chamando o nome da classe como uma função.
4466

4567
```yuescript

doc/docs/zh/doc/objects/object-oriented-programming.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,28 @@ class Inventory
3838

3939
&emsp;&emsp;此外,“@” 前缀在变量名上起到了简化作用,代表 “self”。例如,`@items` 就等同于 `self.items`
4040

41+
&emsp;&emsp;类定义块中也支持通过尖括号写元方法字段,例如 `<tostring>`
42+
43+
```yuescript
44+
class User
45+
new: (@name) =>
46+
<tostring>: => "User(#{@name})"
47+
48+
print tostring User "Yue"
49+
```
50+
51+
<YueDisplay>
52+
53+
```yue
54+
class User
55+
new: (@name) =>
56+
<tostring>: => "User(#{@name})"
57+
58+
print tostring User "Yue"
59+
```
60+
61+
</YueDisplay>
62+
4163
&emsp;&emsp;为了创建类的一个新实例,可以将类名当作一个函数来调用,这样就可以生成并返回一个新的实例。
4264

4365
```yuescript

doc/yue-de.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,16 @@ Beachte, dass alle Methoden in der Klasse die Fat-Arrow-Syntax verwenden. Beim A
508508

509509
Das `@`-Präfix ist Kurzform für `self.`. `@items` wird zu `self.items`.
510510

511+
Der Klassenblock unterstützt auch Metatable-Felder, indem Metamethod-Schlüssel in spitzen Klammern geschrieben werden, zum Beispiel `<tostring>`.
512+
513+
```yuescript
514+
class User
515+
new: (@name) =>
516+
<tostring>: => "User(#{@name})"
517+
518+
print tostring User "Yue"
519+
```
520+
511521
Eine Instanz der Klasse wird erstellt, indem man den Klassennamen wie eine Funktion aufruft.
512522

513523
```yuescript

doc/yue-en.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,16 @@ Notice how all the methods in the class use the fat arrow function syntax. When
508508

509509
The @ prefix on a variable name is shorthand for self.. @items becomes self.items.
510510

511+
The class block also supports metatable fields by writing metamethod keys in angle brackets, such as `<tostring>`.
512+
513+
```yuescript
514+
class User
515+
new: (@name) =>
516+
<tostring>: => "User(#{@name})"
517+
518+
print tostring User "Yue"
519+
```
520+
511521
Creating an instance of the class is done by calling the name of the class as a function.
512522

513523
```yuescript

doc/yue-id-id.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,16 @@ Perhatikan bahwa semua method di kelas menggunakan sintaks fungsi panah tebal. S
508508

509509
Prefiks `@` pada nama variabel adalah singkatan untuk `self.`. `@items` menjadi `self.items`.
510510

511+
Blok kelas juga mendukung field metatable dengan menulis key metamethod dalam tanda kurung sudut, misalnya `<tostring>`.
512+
513+
```yuescript
514+
class User
515+
new: (@name) =>
516+
<tostring>: => "User(#{@name})"
517+
518+
print tostring User "Yue"
519+
```
520+
511521
Membuat instance kelas dilakukan dengan memanggil nama kelas sebagai fungsi.
512522

513523
```yuescript

doc/yue-pt-br.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,16 @@ Observe como todos os métodos da classe usam a sintaxe de função seta fat. Ao
508508

509509
O prefixo @ em um nome de variável é abreviação para self.. @items torna-se self.items.
510510

511+
O bloco da classe também suporta campos de metatable escrevendo chaves de metamétodo entre `<>`, como `<tostring>`.
512+
513+
```yuescript
514+
class User
515+
new: (@name) =>
516+
<tostring>: => "User(#{@name})"
517+
518+
print tostring User "Yue"
519+
```
520+
511521
Criar uma instância da classe é feito chamando o nome da classe como uma função.
512522

513523
```yuescript

doc/yue-zh.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,16 @@ class Inventory
506506

507507
&emsp;&emsp;此外,“@” 前缀在变量名上起到了简化作用,代表 “self”。例如,`@items` 就等同于 `self.items`
508508

509+
&emsp;&emsp;类定义块中也支持通过尖括号写元方法字段,例如 `<tostring>`
510+
511+
```yuescript
512+
class User
513+
new: (@name) =>
514+
<tostring>: => "User(#{@name})"
515+
516+
print tostring User "Yue"
517+
```
518+
509519
&emsp;&emsp;为了创建类的一个新实例,可以将类名当作一个函数来调用,这样就可以生成并返回一个新的实例。
510520

511521
```yuescript

0 commit comments

Comments
 (0)