aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/docs/de/doc/objects/object-oriented-programming.md22
-rw-r--r--doc/docs/doc/objects/object-oriented-programming.md22
-rw-r--r--doc/docs/id-id/doc/objects/object-oriented-programming.md22
-rw-r--r--doc/docs/pt-br/doc/objects/object-oriented-programming.md22
-rw-r--r--doc/docs/zh/doc/objects/object-oriented-programming.md22
-rw-r--r--doc/yue-de.md10
-rw-r--r--doc/yue-en.md10
-rw-r--r--doc/yue-id-id.md10
-rw-r--r--doc/yue-pt-br.md10
-rw-r--r--doc/yue-zh.md10
10 files changed, 160 insertions, 0 deletions
diff --git a/doc/docs/de/doc/objects/object-oriented-programming.md b/doc/docs/de/doc/objects/object-oriented-programming.md
index 706cfda..705fc08 100644
--- a/doc/docs/de/doc/objects/object-oriented-programming.md
+++ b/doc/docs/de/doc/objects/object-oriented-programming.md
@@ -40,6 +40,28 @@ Beachte, dass alle Methoden in der Klasse die Fat-Arrow-Syntax verwenden. Beim A
40 40
41Das `@`-Präfix ist Kurzform für `self.`. `@items` wird zu `self.items`. 41Das `@`-Präfix ist Kurzform für `self.`. `@items` wird zu `self.items`.
42 42
43Der Klassenblock unterstützt auch Metatable-Felder, indem Metamethod-Schlüssel in spitzen Klammern geschrieben werden, zum Beispiel `<tostring>`.
44
45```yuescript
46class User
47 new: (@name) =>
48 <tostring>: => "User(#{@name})"
49
50print tostring User "Yue"
51```
52
53<YueDisplay>
54
55```yue
56class User
57 new: (@name) =>
58 <tostring>: => "User(#{@name})"
59
60print tostring User "Yue"
61```
62
63</YueDisplay>
64
43Eine Instanz der Klasse wird erstellt, indem man den Klassennamen wie eine Funktion aufruft. 65Eine Instanz der Klasse wird erstellt, indem man den Klassennamen wie eine Funktion aufruft.
44 66
45```yuescript 67```yuescript
diff --git a/doc/docs/doc/objects/object-oriented-programming.md b/doc/docs/doc/objects/object-oriented-programming.md
index 781ab65..b3325fa 100644
--- a/doc/docs/doc/objects/object-oriented-programming.md
+++ b/doc/docs/doc/objects/object-oriented-programming.md
@@ -40,6 +40,28 @@ Notice how all the methods in the class use the fat arrow function syntax. When
40 40
41The @ prefix on a variable name is shorthand for self.. @items becomes self.items. 41The @ prefix on a variable name is shorthand for self.. @items becomes self.items.
42 42
43The class block also supports metatable fields by writing metamethod keys in angle brackets, such as `<tostring>`.
44
45```yuescript
46class User
47 new: (@name) =>
48 <tostring>: => "User(#{@name})"
49
50print tostring User "Yue"
51```
52
53<YueDisplay>
54
55```yue
56class User
57 new: (@name) =>
58 <tostring>: => "User(#{@name})"
59
60print tostring User "Yue"
61```
62
63</YueDisplay>
64
43Creating an instance of the class is done by calling the name of the class as a function. 65Creating an instance of the class is done by calling the name of the class as a function.
44 66
45```yuescript 67```yuescript
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 7d5d420..cc74690 100644
--- a/doc/docs/id-id/doc/objects/object-oriented-programming.md
+++ b/doc/docs/id-id/doc/objects/object-oriented-programming.md
@@ -40,6 +40,28 @@ Perhatikan bahwa semua method di kelas menggunakan sintaks fungsi panah tebal. S
40 40
41Prefiks `@` pada nama variabel adalah singkatan untuk `self.`. `@items` menjadi `self.items`. 41Prefiks `@` pada nama variabel adalah singkatan untuk `self.`. `@items` menjadi `self.items`.
42 42
43Blok kelas juga mendukung field metatable dengan menulis key metamethod dalam tanda kurung sudut, misalnya `<tostring>`.
44
45```yuescript
46class User
47 new: (@name) =>
48 <tostring>: => "User(#{@name})"
49
50print tostring User "Yue"
51```
52
53<YueDisplay>
54
55```yue
56class User
57 new: (@name) =>
58 <tostring>: => "User(#{@name})"
59
60print tostring User "Yue"
61```
62
63</YueDisplay>
64
43Membuat instance kelas dilakukan dengan memanggil nama kelas sebagai fungsi. 65Membuat instance kelas dilakukan dengan memanggil nama kelas sebagai fungsi.
44 66
45```yuescript 67```yuescript
diff --git a/doc/docs/pt-br/doc/objects/object-oriented-programming.md b/doc/docs/pt-br/doc/objects/object-oriented-programming.md
index 54a559a..01aeff3 100644
--- a/doc/docs/pt-br/doc/objects/object-oriented-programming.md
+++ b/doc/docs/pt-br/doc/objects/object-oriented-programming.md
@@ -40,6 +40,28 @@ Observe como todos os métodos da classe usam a sintaxe de função seta fat. Ao
40 40
41O prefixo @ em um nome de variável é abreviação para self.. @items torna-se self.items. 41O prefixo @ em um nome de variável é abreviação para self.. @items torna-se self.items.
42 42
43O bloco da classe também suporta campos de metatable escrevendo chaves de metamétodo entre `<>`, como `<tostring>`.
44
45```yuescript
46class User
47 new: (@name) =>
48 <tostring>: => "User(#{@name})"
49
50print tostring User "Yue"
51```
52
53<YueDisplay>
54
55```yue
56class User
57 new: (@name) =>
58 <tostring>: => "User(#{@name})"
59
60print tostring User "Yue"
61```
62
63</YueDisplay>
64
43Criar uma instância da classe é feito chamando o nome da classe como uma função. 65Criar uma instância da classe é feito chamando o nome da classe como uma função.
44 66
45```yuescript 67```yuescript
diff --git a/doc/docs/zh/doc/objects/object-oriented-programming.md b/doc/docs/zh/doc/objects/object-oriented-programming.md
index 04f816a..270c2b3 100644
--- a/doc/docs/zh/doc/objects/object-oriented-programming.md
+++ b/doc/docs/zh/doc/objects/object-oriented-programming.md
@@ -38,6 +38,28 @@ class Inventory
38 38
39&emsp;&emsp;此外,“@” 前缀在变量名上起到了简化作用,代表 “self”。例如,`@items` 就等同于 `self.items`。 39&emsp;&emsp;此外,“@” 前缀在变量名上起到了简化作用,代表 “self”。例如,`@items` 就等同于 `self.items`。
40 40
41&emsp;&emsp;类定义块中也支持通过尖括号写元方法字段,例如 `<tostring>`。
42
43```yuescript
44class User
45 new: (@name) =>
46 <tostring>: => "User(#{@name})"
47
48print tostring User "Yue"
49```
50
51<YueDisplay>
52
53```yue
54class User
55 new: (@name) =>
56 <tostring>: => "User(#{@name})"
57
58print tostring User "Yue"
59```
60
61</YueDisplay>
62
41&emsp;&emsp;为了创建类的一个新实例,可以将类名当作一个函数来调用,这样就可以生成并返回一个新的实例。 63&emsp;&emsp;为了创建类的一个新实例,可以将类名当作一个函数来调用,这样就可以生成并返回一个新的实例。
42 64
43```yuescript 65```yuescript
diff --git a/doc/yue-de.md b/doc/yue-de.md
index f0979e0..97063f4 100644
--- a/doc/yue-de.md
+++ b/doc/yue-de.md
@@ -508,6 +508,16 @@ Beachte, dass alle Methoden in der Klasse die Fat-Arrow-Syntax verwenden. Beim A
508 508
509Das `@`-Präfix ist Kurzform für `self.`. `@items` wird zu `self.items`. 509Das `@`-Präfix ist Kurzform für `self.`. `@items` wird zu `self.items`.
510 510
511Der Klassenblock unterstützt auch Metatable-Felder, indem Metamethod-Schlüssel in spitzen Klammern geschrieben werden, zum Beispiel `<tostring>`.
512
513```yuescript
514class User
515 new: (@name) =>
516 <tostring>: => "User(#{@name})"
517
518print tostring User "Yue"
519```
520
511Eine Instanz der Klasse wird erstellt, indem man den Klassennamen wie eine Funktion aufruft. 521Eine Instanz der Klasse wird erstellt, indem man den Klassennamen wie eine Funktion aufruft.
512 522
513```yuescript 523```yuescript
diff --git a/doc/yue-en.md b/doc/yue-en.md
index 6680281..8f8370d 100644
--- a/doc/yue-en.md
+++ b/doc/yue-en.md
@@ -508,6 +508,16 @@ Notice how all the methods in the class use the fat arrow function syntax. When
508 508
509The @ prefix on a variable name is shorthand for self.. @items becomes self.items. 509The @ prefix on a variable name is shorthand for self.. @items becomes self.items.
510 510
511The class block also supports metatable fields by writing metamethod keys in angle brackets, such as `<tostring>`.
512
513```yuescript
514class User
515 new: (@name) =>
516 <tostring>: => "User(#{@name})"
517
518print tostring User "Yue"
519```
520
511Creating an instance of the class is done by calling the name of the class as a function. 521Creating an instance of the class is done by calling the name of the class as a function.
512 522
513```yuescript 523```yuescript
diff --git a/doc/yue-id-id.md b/doc/yue-id-id.md
index 863e187..39ba24d 100644
--- a/doc/yue-id-id.md
+++ b/doc/yue-id-id.md
@@ -508,6 +508,16 @@ Perhatikan bahwa semua method di kelas menggunakan sintaks fungsi panah tebal. S
508 508
509Prefiks `@` pada nama variabel adalah singkatan untuk `self.`. `@items` menjadi `self.items`. 509Prefiks `@` pada nama variabel adalah singkatan untuk `self.`. `@items` menjadi `self.items`.
510 510
511Blok kelas juga mendukung field metatable dengan menulis key metamethod dalam tanda kurung sudut, misalnya `<tostring>`.
512
513```yuescript
514class User
515 new: (@name) =>
516 <tostring>: => "User(#{@name})"
517
518print tostring User "Yue"
519```
520
511Membuat instance kelas dilakukan dengan memanggil nama kelas sebagai fungsi. 521Membuat instance kelas dilakukan dengan memanggil nama kelas sebagai fungsi.
512 522
513```yuescript 523```yuescript
diff --git a/doc/yue-pt-br.md b/doc/yue-pt-br.md
index a1408c2..a0e3268 100644
--- a/doc/yue-pt-br.md
+++ b/doc/yue-pt-br.md
@@ -508,6 +508,16 @@ Observe como todos os métodos da classe usam a sintaxe de função seta fat. Ao
508 508
509O prefixo @ em um nome de variável é abreviação para self.. @items torna-se self.items. 509O prefixo @ em um nome de variável é abreviação para self.. @items torna-se self.items.
510 510
511O bloco da classe também suporta campos de metatable escrevendo chaves de metamétodo entre `<>`, como `<tostring>`.
512
513```yuescript
514class User
515 new: (@name) =>
516 <tostring>: => "User(#{@name})"
517
518print tostring User "Yue"
519```
520
511Criar uma instância da classe é feito chamando o nome da classe como uma função. 521Criar uma instância da classe é feito chamando o nome da classe como uma função.
512 522
513```yuescript 523```yuescript
diff --git a/doc/yue-zh.md b/doc/yue-zh.md
index ac7e4b2..cb44d22 100644
--- a/doc/yue-zh.md
+++ b/doc/yue-zh.md
@@ -506,6 +506,16 @@ class Inventory
506 506
507&emsp;&emsp;此外,“@” 前缀在变量名上起到了简化作用,代表 “self”。例如,`@items` 就等同于 `self.items`。 507&emsp;&emsp;此外,“@” 前缀在变量名上起到了简化作用,代表 “self”。例如,`@items` 就等同于 `self.items`。
508 508
509&emsp;&emsp;类定义块中也支持通过尖括号写元方法字段,例如 `<tostring>`。
510
511```yuescript
512class User
513 new: (@name) =>
514 <tostring>: => "User(#{@name})"
515
516print tostring User "Yue"
517```
518
509&emsp;&emsp;为了创建类的一个新实例,可以将类名当作一个函数来调用,这样就可以生成并返回一个新的实例。 519&emsp;&emsp;为了创建类的一个新实例,可以将类名当作一个函数来调用,这样就可以生成并返回一个新的实例。
510 520
511```yuescript 521```yuescript