aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/inputs/metatable.yue43
1 files changed, 43 insertions, 0 deletions
diff --git a/spec/inputs/metatable.yue b/spec/inputs/metatable.yue
new file mode 100644
index 0000000..6f7b418
--- /dev/null
+++ b/spec/inputs/metatable.yue
@@ -0,0 +1,43 @@
1a = close: true, close#: => print "out of scope"
2b = add#: (left, right)-> right - left
3c = key1: true, :add#, key2: true
4
5close _ = close#: -> print "out of scope"
6
7d, e = a.close, a.close#
8
9f = a\close# 1
10a.add# = (x, y)-> x + y
11
12do
13 {:new, :close#, close#: closeA} = a
14 print new, close, closeA
15
16do
17 local *
18 x, \
19 {:new, :var, :close#, close#: closeA}, \
20 :num, :add#, :sub# \
21 = 123, a.b.c, func!
22
23x.abc, a.b.# = 123, {}
24func!.# = mt, extra
25a, b.c.#, d, e = 1, mt, "abc"
26
27is_same = a.#.__index == a.index#
28
29--
30a.# = __index: tb
31a.#.__index = tb
32a.index# = tb
33--
34
35mt = a.#
36
37tb\func #list
38tb\func#list
39tb\func# list
40
41import "module" as :index#, newindex#:setFunc
42
43nil