From 3136adbe00c2f42a52caf371429a7ad22a54e3ab Mon Sep 17 00:00:00 2001 From: BuckarooBanzay Date: Fri, 11 Oct 2019 08:12:18 +0200 Subject: [PATCH] add .luacheckrc and fix common errors --- .luacheckrc | 19 +++++++++++++++++++ init.lua | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 .luacheckrc diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..e4991d5 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,19 @@ + +globals = { + "lightning" +} + +read_globals = { + -- Stdlib + string = {fields = {"split"}}, + table = {fields = {"copy", "getn"}}, + "PcgRandom", + + -- Minetest + "minetest", + "vector", "ItemStack", + "dump", + + -- mods + "default", "fire" +} diff --git a/init.lua b/init.lua index 27ab412..b24d6c4 100644 --- a/init.lua +++ b/init.lua @@ -34,7 +34,7 @@ local revertsky = function() return end - for key, entry in pairs(ps) do + for _, entry in pairs(ps) do local sky = entry.sky entry.p:set_sky(sky.bgcolor, sky.type, sky.textures) end @@ -217,7 +217,7 @@ minetest.register_node("lightning:dying_flame", { }) -- if other mods disable auto lightning during initialization, don't trigger the first lightning. -minetest.after(5, function(dtime) +minetest.after(5, function() if lightning.auto then minetest.after(rng:next(lightning.interval_low, lightning.interval_high), lightning.strike)