Use upvalues

This commit is contained in:
Robert Machmer 2016-01-12 16:03:43 +01:00
parent 65d78b3ca9
commit 638d72ae20

View File

@ -36,14 +36,10 @@ function Graph.new()
--- ---
-- Updates the boundaries of the graph. -- Updates the boundaries of the graph.
-- This represents the rectangular area in which all nodes are contained. -- This represents the rectangular area in which all nodes are contained.
-- @param minX - The current minimum x position.
-- @param maxX - The current maximum y position.
-- @param minY - The current minimum x position.
-- @param maxY - The current maximum y position.
-- @param nx - The new x position to check. -- @param nx - The new x position to check.
-- @param ny - The new y position to check. -- @param ny - The new y position to check.
-- --
local function updateBoundaries( minX, maxX, minY, maxY, nx, ny ) local function updateBoundaries( nx, ny )
return math.min( minX or nx, nx ), math.max( maxX or nx, nx ), math.min( minY or ny, ny ), math.max( maxY or ny, ny ); return math.min( minX or nx, nx ), math.max( maxX or nx, nx ), math.min( minY or ny, ny ), math.max( maxY or ny, ny );
end end
@ -158,7 +154,7 @@ function Graph.new()
nodeCallback( nodeA ); nodeCallback( nodeA );
end end
minX, maxX, minY, maxY = updateBoundaries( minX, maxX, minY, maxY, nodeA:getPosition() ); minX, maxX, minY, maxY = updateBoundaries( nodeA:getPosition() );
end end
end end