-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevents.lua
More file actions
104 lines (85 loc) · 2.55 KB
/
events.lua
File metadata and controls
104 lines (85 loc) · 2.55 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
local ui = require('likelihud')
local events = ui.Layout {
columns = 1,
rows = 2,
ui.Layout {
columns = 3,
rows = 1,
ui.Rectangle {
w = 200,
h = 200,
color = { 0.5, 0.5, 0.5 },
filter = function (self, event)
if event.id ~= 'number.changed' then
return false
end
if event.number % 2 == 0 then
return false
end
return true
end,
inside = {
ui.Label {
text = '1',
maxText = '100',
color = { 1, 1, 1 },
on = {
['number.changed'] = function (self, event)
self.text = tostring(event.number)
end
}
}
}
},
ui.Rectangle {
w = 200,
h = 200,
color = { 0.5, 0.5, 0.5 },
filter = function (self, event)
if event.id ~= 'number.changed' then
return false
end
if event.number % 3 == 0 then
return false
end
return true
end,
inside = {
ui.Label {
text = '2',
maxText = '100',
color = { 1, 1, 1 },
on = {
['number.changed'] = function (self, event)
self.text = tostring(event.number)
end
}
}
}
},
ui.Rectangle {
w = 200,
h = 200,
color = { 0.5, 0.5, 0.5 },
inside = {
ui.Label {
text = '3',
maxText = '100',
color = { 1, 1, 1 },
on = {
['number.changed'] = function (self, event)
self.text = tostring(event.number)
end
}
}
}
},
},
ui.Label {
text = [[Press 'n' and see how the numbers in the squares are
changing: every press increments the number; the first square accepts only
odd numbers, second - only those not divisible by 3, and the third accepts
all.]]
}
}
return events