Port over cmatch optimization

This commit is contained in:
OldManAlpha 2025-07-07 06:33:25 -07:00
parent 391a78af1c
commit 312372df78

View File

@ -68,9 +68,10 @@ function GetCaptures(pat)
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