More cleaning

This commit is contained in:
Jean-Patrick Guerrero 2021-11-29 15:51:12 +01:00
parent b92857b42a
commit 91af3b73d2
3 changed files with 19 additions and 17 deletions

View File

@ -1,6 +1,6 @@
# i3 # i3
[![MIT License](https://img.shields.io/apm/l/atomic-design-ui.svg?)](https://github.com/tterb/atomic-design-ui/blob/master/LICENSEs) ![workflow](https://github.com/minetest-mods/i3/actions/workflows/luacheck.yml/badge.svg) [![GitHub Release](https://img.shields.io/github/release/minetest-mods/i3.svg?style=flat)]() [![ContentDB](https://content.minetest.net/packages/jp/i3/shields/downloads/)](https://content.minetest.net/packages/jp/i3/) [![PayPal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.me/jpg84240) [![MIT License](https://img.shields.io/apm/l/atomic-design-ui.svg?)](https://github.com/tterb/atomic-design-ui/blob/master/LICENSEs) [![GitHub Release](https://img.shields.io/github/release/minetest-mods/i3.svg?style=flat)]() [![ContentDB](https://content.minetest.net/packages/jp/i3/shields/downloads/)](https://content.minetest.net/packages/jp/i3/) [![PayPal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.me/jpg84240)
#### **`i3`** is a next-generation inventory for Minetest. #### **`i3`** is a next-generation inventory for Minetest.

View File

@ -43,11 +43,13 @@ local function compile(data)
return data return data
end end
local function _load(path, line, data) local function _load(path, line, data, t)
if line then if line then
data = data:split"\n" if not t then
data[line] = data[line]:gsub("(" .. var .. "+)%s?=%s?(" .. var .. "*)", function(_,b) return b end) t = data:split"\n"
data = table.concat(data, "\n") end
t[line] = t[line]:gsub("(" .. var .. "+)%s?=%s?(" .. var .. "*)", "%2")
data = table.concat(t, "\n")
else else
local file = assert(io.open(path, "r")) local file = assert(io.open(path, "r"))
data = file:read"*a" data = file:read"*a"
@ -61,7 +63,7 @@ local function _load(path, line, data)
local err_line = tonumber(err:match(":(%d+):")) local err_line = tonumber(err:match(":(%d+):"))
if line ~= err_line then if line ~= err_line then
return _load(path, err_line, data) return _load(path, err_line, data, t)
end end
end end

View File

@ -1,8 +1,6 @@
local a, b, c = 0, 0, 0 local a, b, c = 0, 0, 0
b+=1 b+=1
c++; local foo = "bar"; c++; local foo = "bar";
print(c-=1)
print(c++)
local t = { local t = {
a = a++, a = a++,
b = 2, b = 2,
@ -11,16 +9,18 @@ local t = {
e = 1, e = 1,
} }
t["b"] <<= 4 t["b"] <<= 4
print(dump(t)) t.b >>= 2
assert(t.b == 8)
--print(dump(t))
--c += 1 --c += 1
c*=2 c*=2
local i = 16 local i = 16
i += i<<4 i += i<<4
print(i) -- 272 assert(i == 272)
print(a+=2) -- 2 assert((a+=2) == 2)
print(c++) -- 3 assert(c++ == 3)
print(a-=1) -- -1 assert((a-=1) == -1)
print(c^=4) -- 16 assert((c^=4) == 16)
print(a&b) -- 0 assert((a&b) == 0)
print(c|=a) -- 2 assert((c|=a) == 2)
print(1<<8) -- 256 assert((1<<8) == 256)