From 64bf138eee947a80b8375f5e1939b69c4c8f295f Mon Sep 17 00:00:00 2001 From: BuckarooBanzay Date: Tue, 28 Apr 2020 08:05:06 +0200 Subject: [PATCH] add luacheck --- .luacheckrc | 16 ++++++++++++++++ init.lua | 18 +++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 .luacheckrc diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..129bb9a --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,16 @@ +allow_defined_top = true + +globals = { + "controls", +} + +read_globals = { + -- Stdlib + string = {fields = {"split"}}, + table = {fields = {"copy", "getn"}}, + + -- Minetest + "minetest", + "vector", "ItemStack", + "dump" +} diff --git a/init.lua b/init.lua index ba85aed..20157b4 100644 --- a/init.lua +++ b/init.lua @@ -19,14 +19,14 @@ end minetest.register_on_joinplayer(function(player) local name = player:get_player_name() controls.players[name] = { - jump={false}, - right={false}, - left={false}, - LMB={false}, - RMB={false}, - sneak={false}, - aux1={false}, - down={false}, + jump={false}, + right={false}, + left={false}, + LMB={false}, + RMB={false}, + sneak={false}, + aux1={false}, + down={false}, up={false} } end) @@ -36,7 +36,7 @@ minetest.register_on_leaveplayer(function(player) controls.players[name] = nil end) -minetest.register_globalstep(function(dtime) +minetest.register_globalstep(function() for _, player in pairs(minetest.get_connected_players()) do local player_name = player:get_player_name() local player_controls = player:get_player_control()