mirror of
https://github.com/nmap/nmap.git
synced 2025-12-09 06:01:28 +00:00
Consolidate "contains" functions into stdnse.contains
These implementations were all functionally identical. The replacement has an extra feature of returning the index where the value was found, currently unused.
This commit is contained in:
@@ -122,21 +122,11 @@ action = function(host, port)
|
||||
return #output > 0 and stdnse.strjoin("\n", output) or nil
|
||||
end
|
||||
|
||||
local function contains(t, elem)
|
||||
local _, e
|
||||
for _, e in ipairs(t) do
|
||||
if e == elem then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function filter_out(t, filter)
|
||||
local result = {}
|
||||
local _, e, f
|
||||
for _, e in ipairs(t) do
|
||||
if not contains(filter, e) then
|
||||
if not stdnse.contains(filter, e) then
|
||||
result[#result + 1] = e
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user