-
Notifications
You must be signed in to change notification settings - Fork 251
/
Copy pathexpression.lua
272 lines (158 loc) · 5.41 KB
/
expression.lua
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
--[[
--]]
print ("true or true")
b = true or true
print ("false and false")
b = false and false
print ("false and or")
b = false and (x or y)
print ("false and ((and) or)")
b = false and ((x and z) or y)
print ("precalculated true expression")
c = true or (x and y) or true
print ("precalculated false expression")
d = false and ((x and y) or true)
print ("precalculated false expression with function")
e = error() and false and ((x and y) or true)
print ("precalculated true expression with function")
e = error() and true and ((x and y) or true)
print ("precalculated? false expression with variable")
local z = false
f = z and ((x and y) or true)
print ("precalculated false expression with nil")
f = nil and ((x and y) or true)
print ("simple or expression")
b = x or y
print ("simple or not expression")
b = not x or y
print ("simple and expression")
b = x and y
print ("simple or expression with binary comparison")
b = (x < 100) or y
print ("simple and expression with binary comparison")
b = (x < 100) and y
print ("simple and expression with binary comparison and function call")
b = (x < 100) and print(y)
print ("simple and expression with double binary comparison")
b = (x < 100) and (y > 100)
print ("(and) or expression")
b = (x and y) or z
print ("(or) and expression")
b = (x or y) and z
print ("(and) and expression")
b = (x and y) and z
print ("(or) or expression")
b = (x or y) or z
print ("or (and) expression")
b = x or (y and x)
b = x < 100 or (y < 100 and x < 100)
print ("and (or) expression")
b = x and (y or x)
print ("and (and) expression")
b = x and (y and x)
print ("or (or) expression")
b = x or (y or x)
print ("ond (or) and expression")
b = x and (y or x) and z
print ("or (and) or expression")
b = x or (y and x) or z
print ("and of two ors")
b = (x or z) and (y or z)
print ("or of two ands")
b = (x and z) or (y and z)
print ("x or string")
local xi = "nothing"
xi = x or "something"
local xi
print ("x and string")
xi = x and "something"
print ("and (or) and (or) expression with comparisons")
b = x < 100 and (y < 100 or x < 100) and (z < 100 or x < 100)
print ("and (or) and or or expression with comparisons")
b = x < 100 and (y < 100 or x < 100) and z < 100 or x < 100 or y < 100
print ("and (or) and and and expression with comparisons")
b = x < 100 and (y < 100 or x < 100) and z < 100 and x < 100 and y < 100
print ("or (and) or (and) expression with comparisons")
b = x < 100 or (y < 100 and x < 100) or (z < 100 and x < 100)
print ("and (and) and (and) expression with comparisons")
b = x < 100 and (y < 100 and x < 100) and (z < 100 and x < 100)
print ("or (or) or (or) expression with comparisons")
b = x < 100 or (y < 100 or x < 100) or (z < 100 or x < 100)
print ("4 and expression with comparisons")
b = x < 100 and y < 100 and x < 100 and z < 100 and x < 100
print ("4 or expression with comparisons")
b = x < 100 or y < 100 or x < 100 or z < 100 or x < 100
print ("and (or or) and (or or) expression with comparisons")
b = x < 100 and (y < 100 or x < 100 or z < 100)
and (y < 100 or x < 100 or z < 100)
print ("and (or and or) and (or and or) expression with comparisons")
b = x < 100 and (y < 100 or (x < 100 and x > 100) or z < 100)
and (y < 100 or (x < 100 and x > 100) or z < 100)
print ("or (and or and) or (and or and) expression with comparisons")
b = x < 100 or (y < 100 and (x < 100 or x > 100) and z < 100)
or (y < 100 and (x < 100 or x > 100) and z < 100)
print ("(((or) and) or)")
a = (((x < 100 or y < 100) and x < 100) or z < 100)
print ("(((or or) and) or)")
a = ((x < 100 or y < 100 or z < 100) and x < 100 or z < 100)
print ("(((or and) and) or)")
a = (x < 100 or y < 100 and z < 100) and x < 100 or z < 100
print ("(((or and) and) or) and error()")
a = (((x < 100 or y < 100 and z < 100) and x < 100) or z < 100) and error()
print ("(or (and (or)))")
a = x < 100 or (y < 100 and (x < 100 or z < 100))
print ("(not or (and (or)))")
a = (not (x < 100)) or (y < 100 and (x < 100 or z < 100))
local value = 1.0
value = scaleinfo.floorValue and math.floor(value) or math.ceil(value)
local function foo(a)
print(a)
end
local x = ""
foo(x == "" and x or "test")
local timeout = (menu.isOffer and (duration or -1)) or
((timeout and timeout ~= -1) and timeout or missiontime or -1)
local a = x < 100
local exists = 0
exists = ffi.string(messageDetails.messageType) ~= ""
local row, cells, rowdata, colspans, noscaling, bgColor
if is_magic then
row = foo(bgColor or Helper.defaultArrowRowBackgroundColor)
else
row = bar(bgColor)
end
local a = 0
a = z == 3 and (x < ((y == 0 and is_magic) and 3 or 2)) and "a" or "b"
local a, is_magic, x, y, foo, bar
a = is_magic and foo(x == "station" and y) or bar()
local a = (
((not commander and true or IsSameComponent(commander, menu.playership))
and "") or " [" .. ReadText(1001, 1001) .. "]"
)
local a = isfirst and foo(bar((table[trade.ware] and "-") or "+", 1 < x)) or ""
local a, x, y, is_magic
a = (not x and ( (x < 50 and x < 100 and z) or (is_magic and 4 or 3) )) or x
setElementPosition(iconelement, x, y, width%2 ~= 0, height%2 ~= 0)
if xi then
local unlocked_defence_status = x or ((y or z) < 100)
bar(x and y or z)
end
local function foo()
return {
font = x or y,
fontsize = x or y
}
end
menu.logbook = foo(x or y) or {}
local x, y, bar, do_not_collapse_this_if_please, a
if x then
if y then
a = {
x or y,
bar(x or y) .. x or ""
}
end
do_not_collapse_this_if_please()
end
--[[
--]]