From 4bff740eb3940830e7c874a42291c61813b39d34 Mon Sep 17 00:00:00 2001 From: shagu Date: Mon, 7 Jul 2025 15:18:39 +0200 Subject: [PATCH] helpers: always write capture index cache --- helpers.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/helpers.lua b/helpers.lua index 6206add..7bbd9c4 100644 --- a/helpers.lua +++ b/helpers.lua @@ -145,13 +145,15 @@ end local capture_cache = {} ShaguTweaks.GetCaptures = function(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