api: always write capture index cache

This commit is contained in:
shagu
2025-07-07 15:27:12 +02:00
parent 49bdddf25c
commit 3c44018726
+3 -1
View File
@@ -219,13 +219,15 @@ end
local capture_cache = {}
function pfUI.api.GetCaptures(pat)
local r = capture_cache
if not r[pat] then
for a, b, c, d, e in gfind(gsub(pat, "%((.+)%)", "%1"), gsub(pat, "%d%$", "%%(.-)$")) do
r[pat] = { a, b, c, d, e}
end
r[pat] = r[pat] or {}
end
if not r[pat] then return nil, nil, nil, nil end
return r[pat][1], r[pat][2], r[pat][3], r[pat][4], r[pat][5]
end