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