1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-29 02:49:01 +00:00
This commit is contained in:
dmiller
2015-04-17 03:26:58 +00:00
parent 4a95d8f9b2
commit 1033287ccd

View File

@@ -317,15 +317,17 @@ end
-- @param filter Function that returns bool, which serves as a filter
-- @return function The filtered iterator.
function filter_iterator (iterator, filter)
local function helper (...)
if filter(...) then
return ...
return function (command)
if command == "reset" then
iterator "reset"
else
local val = iterator(command)
while val and not filter(val) do
val = iterator(command)
end
return val
end
end
local function filter (command)
return helper(iterator(command))
end
return filter
end
return _ENV;