aboutsummaryrefslogtreecommitdiff
path: root/example.tsl
blob: 501ddaafd6a034468116075d115efd8941151f89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# loadn 1
# setv "value1"
value1 = 1

# loadn 2
# setv "value1"
value1 = 2

# loadb true
# setv "value2"
value2 = true

# loadnull
# setv "value3"
value3 = null

# loads "hello world"
# setv "value4"
value4 = "hello world"

# loads "hello"
# loads "world"
# loadn 5
# list 3
# setv "value5"
value5 = ["hello", "world", 5]

# loads "hello"
# loads "world"
# loads "value"
# loadn 23
# map 4
# setv "value6"
value6 = {"hello": "world", "value": 23}

# loadf 1       // loadf1 begins at once, because the file body itself is function 0
# setv "value7"
value7 = fn () {}

# loadf 2
# setv "value8"
value8 = fn (value) {}

# loads "hello"
# loads "world"
# loads "sayHello"
# loadf 3
# map 4
value9 = {
    "hello": "world",
    "sayHello": fn() {
        
    }
}

# loadv "value9"
# loadm "hello"
# mindex
# setv "str"
str = value9["hello"]

# loadv "value9"
# loadm "sayHello"
# mindex
# callf 0
value9["sayHello"]()

# loadv "value1"
# loadn 23
# add
# setv "value1"
value1 = value1 + 23

# loadca "curl"
# loadca "https://example.com"
# callc 2
# setv "response"
response = $(curl https://example.com)