Minetest: Boxes: pairs -> ipairs

Proposed by Gregor Parzefall in 1d2b103abe
This commit is contained in:
Lars Mueller 2022-10-29 17:21:09 +02:00
parent 2eaaca5de4
commit 26d9b131a5

@ -1,6 +1,6 @@
-- Localize globals -- Localize globals
local assert, ipairs, math, minetest, pairs, table, type, vector local assert, ipairs, math, minetest, table, type, vector
= assert, ipairs, math, minetest, pairs, table, type, vector = assert, ipairs, math, minetest, table, type, vector
-- Set environment -- Set environment
local _ENV = ... local _ENV = ...
@ -48,7 +48,7 @@ local function get_node_boxes(pos, type)
if box_type == "leveled" then if box_type == "leveled" then
boxes = table.copy(boxes) boxes = table.copy(boxes)
local level = (paramtype2 == "leveled" and node.param2 or node_def.leveled or 0) / 255 - 0.5 local level = (paramtype2 == "leveled" and node.param2 or node_def.leveled or 0) / 255 - 0.5
for _, box in pairs(boxes) do for _, box in ipairs(boxes) do
box[5] = level box[5] = level
end end
elseif box_type == "wallmounted" then elseif box_type == "wallmounted" then
@ -92,7 +92,7 @@ local function get_node_boxes(pos, type)
matchers[i] = nodename_matcher(nodename_or_group) matchers[i] = nodename_matcher(nodename_or_group)
end end
local function connects_to(nodename) local function connects_to(nodename)
for _, matcher in pairs(matchers) do for _, matcher in ipairs(matchers) do
if matcher(nodename) then if matcher(nodename) then
return true return true
end end
@ -130,7 +130,7 @@ local function get_node_boxes(pos, type)
if axis == 2 then if axis == 2 then
sin = -sin sin = -sin
end end
for _, box in pairs(boxes) do for _, box in ipairs(boxes) do
for off = 0, 3, 3 do for off = 0, 3, 3 do
local axis_1, axis_2 = other_axis_1 + off, other_axis_2 + off local axis_1, axis_2 = other_axis_1 + off, other_axis_2 + off
local value_1, value_2 = box[axis_1], box[axis_2] local value_1, value_2 = box[axis_1], box[axis_2]