summaryrefslogtreecommitdiff
path: root/doc/yue-en.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/yue-en.md')
-rw-r--r--doc/yue-en.md10
1 files changed, 10 insertions, 0 deletions
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