From 5c487bd11a48f65bedc6c9d73bf27cd093edc96d Mon Sep 17 00:00:00 2001 From: wsor4035 <24964441+wsor4035@users.noreply.github.com> Date: Sun, 3 Dec 2023 15:36:53 -0500 Subject: [PATCH] more sugar --- init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index f645356..c38f0dc 100644 --- a/init.lua +++ b/init.lua @@ -57,16 +57,16 @@ minetest.register_globalstep(function(dtime) --consider using minetest.get_us_time() instead of os.clock()? would need to convert to seconds however for key, key_status in pairs(pcontrols) do - if key_status and controls.players[pname][key][1]==false then + if key_status and not controls.players[pname][key][1] then for _, callback in pairs(controls.registered_on_press) do callback(player, key) end controls.players[pname][key] = {true, os.clock()} - elseif key_status and controls.players[pname][key][1]==true then + elseif key_status and controls.players[pname][key][1] then for _, callback in pairs(controls.registered_on_hold) do callback(player, key, os.clock() - controls.players[pname][key][2]) end - elseif not key_status and controls.players[pname][key][1]==true then + elseif not key_status and controls.players[pname][key][1] then for _, callback in pairs(controls.registered_on_release) do callback(player, key, os.clock() - controls.players[pname][key][2]) end