Merge pull request #747 from argonui/search-lib

SearchLib: added missing local declaration
This commit is contained in:
dscarpac 2024-07-04 17:28:39 -05:00 committed by GitHub
commit 5be3bc4f7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,7 +30,7 @@ do
max_distance = maxDistance or 0 max_distance = maxDistance or 0
}) })
-- filtering the result -- filter the result for matching objects
local objList = {} local objList = {}
for _, v in ipairs(searchResult) do for _, v in ipairs(searchResult) do
if not filter or filterFunc(v.hit_object) then if not filter or filterFunc(v.hit_object) then
@ -47,22 +47,22 @@ do
-- searches the area on an object -- searches the area on an object
SearchLib.onObject = function(obj, filter) SearchLib.onObject = function(obj, filter)
pos = obj.getPosition() local pos = obj.getPosition()
size = obj.getBounds().size:setAt("y", 1) local size = obj.getBounds().size:setAt("y", 1)
return returnSearchResult(pos, _, size, filter) return returnSearchResult(pos, _, size, filter)
end end
-- searches the specified position (a single point) -- searches the specified position (a single point)
SearchLib.atPosition = function(pos, filter) SearchLib.atPosition = function(pos, filter)
size = { 0.1, 2, 0.1 } local size = { 0.1, 2, 0.1 }
return returnSearchResult(pos, _, size, filter) return returnSearchResult(pos, _, size, filter)
end end
-- searches below the specified position (downwards until y = 0) -- searches below the specified position (downwards until y = 0)
SearchLib.belowPosition = function(pos, filter) SearchLib.belowPosition = function(pos, filter)
size = { 0.1, 2, 0.1 } local size = { 0.1, 2, 0.1 }
direction = { 0, -1, 0 } local direction = { 0, -1, 0 }
maxDistance = pos.y local maxDistance = pos.y
return returnSearchResult(pos, _, size, filter, direction, maxDistance) return returnSearchResult(pos, _, size, filter, direction, maxDistance)
end end