-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfind.lua.lua
More file actions
34 lines (31 loc) · 859 Bytes
/
find.lua.lua
File metadata and controls
34 lines (31 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
local arg = ...
local function find(name, ignore_list)
local search_str = name
local function extend_search()
search_str = string.format("*/%s", search_str)
end
local found = {}
repeat
local items = fs.find(search_str)
extend_search()
if #items > 0 then
for _, item in ipairs(items) do
local ignored = false
for _, ignore in ipairs(ignore_list) do
if item:match(ignore) then
ignored = true
break
end
end
if not ignored then
found[#found + 1] = item
end
end
end
until #fs.find(fs.getDir(search_str)) == 0
return found
end
local finding = find(arg,{"bingus"})
for index, value in ipairs(finding) do
print(value)
end