From 1649f91156f86ce6a91ddd988608be7134e4ead3 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Wed, 20 Feb 2019 23:39:01 +0100 Subject: [PATCH] Tweak the Luacheck configuration file and fix many warnings --- .luacheckrc | 39 +++++++++++++++++++++++++++++--------- stairsplus/custom.lua | 14 ++++++-------- stairsplus/microblocks.lua | 2 -- stairsplus/panels.lua | 2 -- stairsplus/slopes.lua | 2 -- stairsplus/stairs.lua | 2 -- 6 files changed, 36 insertions(+), 25 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index fbf3483..7089a5d 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -1,14 +1,35 @@ +std = "lua51+minetest" unused_args = false allow_defined_top = true +max_line_length = 999 -read_globals = { - "DIR_DELIM", - "minetest", "core", - "dump", - "vector", "nodeupdate", - "VoxelManip", "VoxelArea", - "PseudoRandom", "ItemStack", - "intllib", - "default", +stds.minetest = { + read_globals = { + "DIR_DELIM", + "minetest", + "core", + "dump", + "vector", + "nodeupdate", + "VoxelManip", + "VoxelArea", + "PseudoRandom", + "ItemStack", + "default", + table = { + fields = { + "copy", + }, + }, + } } +read_globals = { + "intllib", + "protector", + "isprotect", + "IsPlayerNodeOwner", + "HasOwner", + "getLastOwner", + "GetNodeOwnerName", +} diff --git a/stairsplus/custom.lua b/stairsplus/custom.lua index e456f7c..e18dac8 100644 --- a/stairsplus/custom.lua +++ b/stairsplus/custom.lua @@ -5,8 +5,6 @@ Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = moreblocks.intllib - --[[ Subset table should have the following format: (You can remove entries as needed.) @@ -75,22 +73,22 @@ function register_custom_subset(subset, modname, subname, recipeitem, groups, im end function stairsplus:register_custom_subset_alias(subset, modname_old, subname_old, modname_new, subname_new) - local subset = table.copy(subset) - for k, v in pairs(subset) do + local subset_copy = table.copy(subset) + for k, v in pairs(subset_copy) do minetest.register_alias(modname_old .. ":" .. v[1] .. "_" .. subname_old .. v[2], modname_new .. ":" .. v[1] .. "_" .. subname_new .. v[2]) end end function stairsplus:register_custom_subset_alias_force(subset, modname_old, subname_old, modname_new, subname_new) - local subset = table.copy(subset) - for k, v in pairs(subset) do + local subset_copy = table.copy(subset) + for k, v in pairs(subset_copy) do minetest.register_alias_force(modname_old .. ":" .. v[1] .. "_" .. subname_old .. v[2], modname_new .. ":" .. v[1] .. "_" .. subname_new .. v[2]) end end function stairsplus:register_custom_subset(subset, modname, subname, recipeitem, fields) - local subset = table.copy(subset) - for k, v in pairs(subset) do + local subset_copy = table.copy(subset) + for k, v in pairs(subset_copy) do stairsplus.register_single(v[1], v[2], stairsplus.defs[v[1]][v[2]], modname, subname, recipeitem, fields) end diff --git a/stairsplus/microblocks.lua b/stairsplus/microblocks.lua index dc8ddfd..738dac7 100644 --- a/stairsplus/microblocks.lua +++ b/stairsplus/microblocks.lua @@ -5,8 +5,6 @@ Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = moreblocks.intllib - -- Node will be called :micro_ function register_micro(modname, subname, recipeitem, groups, images, description, drop, light) diff --git a/stairsplus/panels.lua b/stairsplus/panels.lua index 5e2bf7b..3274a6f 100644 --- a/stairsplus/panels.lua +++ b/stairsplus/panels.lua @@ -5,8 +5,6 @@ Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = moreblocks.intllib - -- Node will be called :panel_ function register_panel(modname, subname, recipeitem, groups, images, description, drop, light) diff --git a/stairsplus/slopes.lua b/stairsplus/slopes.lua index 63635eb..1ea762a 100644 --- a/stairsplus/slopes.lua +++ b/stairsplus/slopes.lua @@ -5,8 +5,6 @@ Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = moreblocks.intllib - -- Node will be called :slope_ function register_slope(modname, subname, recipeitem, groups, images, description, drop, light) diff --git a/stairsplus/stairs.lua b/stairsplus/stairs.lua index 0ccf081..89900ea 100644 --- a/stairsplus/stairs.lua +++ b/stairsplus/stairs.lua @@ -5,8 +5,6 @@ Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = moreblocks.intllib - -- Node will be called :stair_ function register_stair(modname, subname, recipeitem, groups, images, description, drop, light)