Add a .luacheckrc and code style changes

This commit is contained in:
HybridDog 2020-10-11 18:07:16 +02:00
parent 895c590a7c
commit 1060e77140
2 changed files with 26 additions and 8 deletions

18
.luacheckrc Normal file

@ -0,0 +1,18 @@
read_globals = {
"dump",
"vector",
"VoxelArea",
minetest = {
fields = {
add_node = {
read_only = false
},
registered_chatcommands = {
read_only = false,
other_fields = true
}
},
other_fields = true
}
}
globals = {"worldedit"}

@ -418,13 +418,13 @@ local function decompress_nodedata(ccontent)
if cnt then
local indices = {}
local prev_index = 0
for i = 1,cnt do
for k = 1,cnt do
local v = prev_index
for f = ccontent.index_bytes, 0, -1 do
v = v + 2^(8*f) * data:byte(p)
p = p+1
end
indices[i] = v
indices[k] = v
prev_index = v
end
result[indic_names[i]] = indices
@ -784,7 +784,7 @@ local function get_meta_serializable(pos)
end
local we_deserialize = worldedit.deserialize
local function my_we_deserialize(pos, ...)
local function my_we_deserialize(pos_base, ...)
-- remember the previous nodes and meta
local nodes = {}
local metaens = {}
@ -844,7 +844,7 @@ local function my_we_deserialize(pos, ...)
minetest.add_node = my_add_node
local count = we_deserialize(pos, ...)
local count = we_deserialize(pos_base, ...)
minetest.add_node = add_node
@ -996,10 +996,10 @@ undo_funcs.nodes = function(name, data)
local mts = {m_nodes, m_param1s, m_param2s}
local indiceses = {indices_n, indices_p1, indices_p2}
local contentses = {nodeids, param1s, param2s}
for i = 1,3 do
local mt = mts[i]
local indices = indiceses[i]
local contents = contentses[i]
for mtsi = 1,3 do
local mt = mts[mtsi]
local indices = indiceses[mtsi]
local contents = contentses[mtsi]
for k = 1,#indices do
local i = indices[k]
local x = i % ystride