mirror of
https://github.com/minetest-mods/i3.git
synced 2025-06-28 06:40:17 +02:00
Add custom operators (Part 1)
This commit is contained in:
28
tests/test_operators.lua
Normal file
28
tests/test_operators.lua
Normal file
@ -0,0 +1,28 @@
|
||||
local a, b, c = 0, 0, 0
|
||||
|
||||
b+=1
|
||||
c++; local foo = "bar";
|
||||
print(c-=1)
|
||||
print(c++)
|
||||
local t = {
|
||||
a = a++,
|
||||
b = b++,
|
||||
c = c++,
|
||||
d = a&3,
|
||||
}
|
||||
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
|
Reference in New Issue
Block a user