From e5cdeef141e0e10e71c6707f2850648a053a5206 Mon Sep 17 00:00:00 2001 From: HybridDog Date: Sun, 7 Mar 2021 19:19:00 +0100 Subject: [PATCH] Remove unused loop variables --- moremesecons_commandblock/init.lua | 2 +- moremesecons_conductor_signalchanger/init.lua | 4 ++-- moremesecons_dual_delayer/init.lua | 4 ++-- moremesecons_injector_controller/init.lua | 4 ++-- moremesecons_mesechest/init.lua | 2 +- moremesecons_playerkiller/init.lua | 2 +- moremesecons_signalchanger/init.lua | 4 ++-- moremesecons_teleporter/init.lua | 2 +- moremesecons_timegate/init.lua | 4 ++-- moremesecons_utils/init.lua | 4 ++-- moremesecons_wireless/init.lua | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/moremesecons_commandblock/init.lua b/moremesecons_commandblock/init.lua index 9ecc4d1..9826e93 100644 --- a/moremesecons_commandblock/init.lua +++ b/moremesecons_commandblock/init.lua @@ -55,7 +55,7 @@ local function resolve_commands(commands, pos) local nearest = nil local min_distance = math.huge local players = minetest.get_connected_players() - for index, player in pairs(players) do + for _, player in pairs(players) do local distance = vector.distance(pos, player:getpos()) if distance < min_distance then min_distance = distance diff --git a/moremesecons_conductor_signalchanger/init.lua b/moremesecons_conductor_signalchanger/init.lua index 6edc50d..fc47e51 100644 --- a/moremesecons_conductor_signalchanger/init.lua +++ b/moremesecons_conductor_signalchanger/init.lua @@ -5,7 +5,7 @@ local nodebox = { local function signalchanger_get_output_rules(node) local rules = {{x=-1, y=0, z=0}} - for i = 0, node.param2 do + for _ = 0, node.param2 do rules = mesecon.rotate_rules_left(rules) end return rules @@ -13,7 +13,7 @@ end local function signalchanger_get_input_rules(node) local rules = {{x=0, y=0, z=-1, name="input_on"}, {x=0, y=0, z=1, name="input_off"}, {x=1, y=0, z=0, name="input_signal"}} - for i = 0, node.param2 do + for _ = 0, node.param2 do rules = mesecon.rotate_rules_left(rules) end return rules diff --git a/moremesecons_dual_delayer/init.lua b/moremesecons_dual_delayer/init.lua index 3c64ebe..436dc73 100644 --- a/moremesecons_dual_delayer/init.lua +++ b/moremesecons_dual_delayer/init.lua @@ -1,6 +1,6 @@ local function dual_delayer_get_input_rules(node) local rules = {{x=1, y=0, z=0}} - for i = 0, node.param2 do + for _ = 0, node.param2 do rules = mesecon.rotate_rules_left(rules) end return rules @@ -8,7 +8,7 @@ end local function dual_delayer_get_output_rules(node) local rules = {{x=0, y=0, z=1}, {x=0, y=0, z=-1}} - for i = 0, node.param2 do + for _ = 0, node.param2 do rules = mesecon.rotate_rules_left(rules) end return rules diff --git a/moremesecons_injector_controller/init.lua b/moremesecons_injector_controller/init.lua index 8851d89..5be9f07 100644 --- a/moremesecons_injector_controller/init.lua +++ b/moremesecons_injector_controller/init.lua @@ -1,6 +1,6 @@ local injector_controller_get_output_rules = function(node) local rules = {{x = 0, y = 0, z = 1}} - for i = 0, node.param2 do + for _ = 0, node.param2 do rules = mesecon.rotate_rules_left(rules) end return rules @@ -10,7 +10,7 @@ local injector_controller_get_input_rules = function(node) local rules = {{x = 0, y = 0, z = -1}, {x = 1, y = 0, z = 0}, {x = -1, y = 0, z = 0}} - for i = 0, node.param2 do + for _ = 0, node.param2 do rules = mesecon.rotate_rules_left(rules) end return rules diff --git a/moremesecons_mesechest/init.lua b/moremesecons_mesechest/init.lua index 69b7bbe..3c7f7ca 100644 --- a/moremesecons_mesechest/init.lua +++ b/moremesecons_mesechest/init.lua @@ -2,7 +2,7 @@ local function mesechest_get_output_rules(node) local rules = {{x=-1, y=0, z=0}, {x=0, y=0, z=-1}, {x=0, y=0, z=1}} - for i = 0, node.param2 do + for _ = 0, node.param2 do rules = mesecon.rotate_rules_left(rules) end return rules diff --git a/moremesecons_playerkiller/init.lua b/moremesecons_playerkiller/init.lua index b47e2db..dea28da 100644 --- a/moremesecons_playerkiller/init.lua +++ b/moremesecons_playerkiller/init.lua @@ -4,7 +4,7 @@ local kill_nearest_player = function(pos) -- Search the nearest player local nearest local min_distance = MAX_DISTANCE - for index, player in pairs(minetest.get_connected_players()) do + for _, player in pairs(minetest.get_connected_players()) do local distance = vector.distance(pos, player:getpos()) if distance < min_distance then min_distance = distance diff --git a/moremesecons_signalchanger/init.lua b/moremesecons_signalchanger/init.lua index 9b709db..0de3526 100644 --- a/moremesecons_signalchanger/init.lua +++ b/moremesecons_signalchanger/init.lua @@ -6,7 +6,7 @@ local nodebox = { local function signalchanger_get_output_rules(node) local rules = {{x=-1, y=0, z=0}, {x=1, y=0, z=0}} - for i = 0, node.param2 do + for _ = 0, node.param2 do rules = mesecon.rotate_rules_left(rules) end return rules @@ -14,7 +14,7 @@ end local function signalchanger_get_input_rules(node) local rules = {{x=0, y=0, z=-1, name="input_on"}, {x=0, y=0, z=1, name="input_off"}} - for i = 0, node.param2 do + for _ = 0, node.param2 do rules = mesecon.rotate_rules_left(rules) end return rules diff --git a/moremesecons_teleporter/init.lua b/moremesecons_teleporter/init.lua index 87bca1f..3647128 100644 --- a/moremesecons_teleporter/init.lua +++ b/moremesecons_teleporter/init.lua @@ -26,7 +26,7 @@ local function teleport_nearest(pos) local nearest = nil local min_distance = MAX_PLAYER_DISTANCE local players = minetest.get_connected_players() - for index, player in pairs(players) do + for _, player in pairs(players) do local distance = vector.distance(pos, player:getpos()) if distance <= min_distance then min_distance = distance diff --git a/moremesecons_timegate/init.lua b/moremesecons_timegate/init.lua index 7872bab..719ddd7 100644 --- a/moremesecons_timegate/init.lua +++ b/moremesecons_timegate/init.lua @@ -1,6 +1,6 @@ local timegate_get_output_rules = function(node) local rules = {{x = 0, y = 0, z = 1}} - for i = 0, node.param2 do + for _ = 0, node.param2 do rules = mesecon.rotate_rules_left(rules) end return rules @@ -8,7 +8,7 @@ end local timegate_get_input_rules = function(node) local rules = {{x = 0, y = 0, z = -1}} - for i = 0, node.param2 do + for _ = 0, node.param2 do rules = mesecon.rotate_rules_left(rules) end return rules diff --git a/moremesecons_utils/init.lua b/moremesecons_utils/init.lua index 848381d..6f79fde 100644 --- a/moremesecons_utils/init.lua +++ b/moremesecons_utils/init.lua @@ -339,14 +339,14 @@ local function do_test() end end local i = 0 - for pos, v in data:iter({x=-4, y=-4, z=-4}, {x=2, y=2, z=2}) do + for pos in data:iter({x=-4, y=-4, z=-4}, {x=2, y=2, z=2}) do i = i + 1 assert(vector.equals(pos, expected_positions[i])) end print("Test if iter works correctly on a corner") local found = false - for pos, v in data:iter({x=-8, y=-7, z=-80}, {x=-5, y=-5, z=-5}) do + for pos in data:iter({x=-8, y=-7, z=-80}, {x=-5, y=-5, z=-5}) do assert(not found) found = true assert(vector.equals(pos, {x=-5, y=-5, z=-5})) diff --git a/moremesecons_wireless/init.lua b/moremesecons_wireless/init.lua index 34d92fe..268e7cf 100644 --- a/moremesecons_wireless/init.lua +++ b/moremesecons_wireless/init.lua @@ -188,7 +188,7 @@ end function activate_network(owner, channel) local network = wireless[owner][channel] - for i, wl_pos in pairs(network.members) do + for _, wl_pos in pairs(network.members) do wireless_receptor_on(wl_pos, id, network) end end