forked from minetest-mods/MoreMesecons
Remove unused loop variables
This commit is contained in:
parent
182eb9822a
commit
e5cdeef141
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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}))
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user