minetest-i4/tests/test_operators.lua

27 lines
339 B
Lua
Raw Normal View History

2021-11-28 16:55:11 -06:00
local a, b, c = 0, 0, 0
b+=1
c++; local foo = "bar";
print(c-=1)
print(c++)
local t = {
a = a++,
2021-11-28 19:47:36 -06:00
b = 2,
c = c+=2,
2021-11-28 16:55:11 -06:00
d = a&3,
2021-11-28 19:47:36 -06:00
e = 1,
2021-11-28 16:55:11 -06:00
}
2021-11-28 19:47:36 -06:00
t["b"] <<= 4
2021-11-28 16:55:11 -06:00
print(dump(t))
--c += 1
c*=2
local i = 16
i += i<<4
print(i) -- 272
print(a+=2) -- 2
print(c++) -- 3
print(a-=1) -- -1
print(c^=4) -- 16
print(a&b) -- 0
print(c|=a) -- 2
print(1<<8) -- 256