Skip to content

Commit 7f772a3

Browse files
committed
Made list and xlist check more compact with a helper function.
1 parent f8e0069 commit 7f772a3

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

arch/UNZIP.LUA

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,17 @@ function unzip(z, d, l, x)
6363
fn, E = f:read(nl) D() -- read the filename
6464
if el > 0 then f:seek(re, el) end
6565

66-
if x then -- Skip file if it's on the exclude list
67-
for _, i in ipairs(x) do if i == fn then f:seek(re, cs) goto L end end
66+
---Table has file name string
67+
---@param t table The table to check for the string
68+
---@return boolean true if name exists
69+
function H(t)
70+
for _, i in ipairs(t) do
71+
if i == fn then return true end
72+
end
6873
end
6974

70-
if l then -- Skip file if it's not on the include list
71-
for _, i in ipairs(l) do if i == fn then j = 1 break end end
72-
if j > 0 then f:seek(re, cs) goto L end
73-
end
75+
-- Check if this file should be included or excluded from extraction
76+
if (x and H(x)) or (l and not H(l)) then f:seek(re, cs) goto L end
7477

7578
re = cs
7679

0 commit comments

Comments
 (0)