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
[![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.

View File

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

View File

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