Various code fixes detected by luacheck

* Luablock: Fix the missing position argument when executing the lua code fails
* Wireless: Fix the missing id argument
* Localize several variables
* Some other small changes, e.g. dead code removal
This commit is contained in:
HybridDog
2021-03-08 19:34:21 +01:00
committed by Pierre-Adrien Langrognet
parent 28292dc2a5
commit c41d0371c0
10 changed files with 39 additions and 41 deletions

View File

@ -76,14 +76,17 @@ end]]
local file_path = minetest.get_worldpath().."/MoreMesecons_lctt"
-- load templates from a compressed file
local templates_file = io.open(file_path, "rb")
if templates_file then
local templates_raw = templates_file:read("*all")
io.close(templates_file)
if templates_raw
and templates_raw ~= "" then
for name,t in pairs(minetest.deserialize(minetest.decompress(templates_raw))) do
templates[name] = t
do
local templates_file = io.open(file_path, "rb")
if templates_file then
local templates_raw = templates_file:read("*all")
io.close(templates_file)
if templates_raw
and templates_raw ~= "" then
local data = minetest.deserialize(minetest.decompress(templates_raw))
for name,t in pairs(data) do
templates[name] = t
end
end
end
end