fix linter nags

This commit is contained in:
Max Cahill 2023-12-05 12:33:29 +11:00
parent 4a3740cf53
commit 5641b393e4

View File

@ -26,7 +26,7 @@ local generate_constant = function() return 1 end
-- can be used to speed up searches at the cost of accuracy by returning some proportion higher than the actual distance -- can be used to speed up searches at the cost of accuracy by returning some proportion higher than the actual distance
-- defaults to a constant value, which means the A* algorithm degrades to breadth-first search -- defaults to a constant value, which means the A* algorithm degrades to breadth-first search
-- alias: h -- alias: h
function pathfind(args) local function pathfind(args)
local start = args.start or args.start_node local start = args.start or args.start_node
local is_goal = args.is_goal or args.goal local is_goal = args.is_goal or args.goal
local neighbours = args.neighbours or args.generate_neighbours local neighbours = args.neighbours or args.generate_neighbours
@ -70,15 +70,13 @@ function pathfind(args)
return false return false
end end
--build up the ordering --build up result path
local path = {} local result = {}
while current do while current do
table.insert(path, 1, current) table.insert(result, 1, current)
current = predecessor[current] current = predecessor[current]
end end
return result
--return a path
return path
end end
-- Based on https://github.com/lewtds/pathfinder.lua/blob/master/pathfinder.lua -- Based on https://github.com/lewtds/pathfinder.lua/blob/master/pathfinder.lua