[karaoke-split] gmatch is magic

This commit is contained in:
odrling 2019-08-01 22:18:34 +02:00
parent 3f84fc4914
commit 6ef9e2f765

View file

@ -11,11 +11,8 @@ function split_line(subs, sel)
d = 0
kduration = "{[^}]-\\[kK][fo]?(%d+)[^}]-}"
_, iend, match = line:find(kduration)
while match do
for match in line:gmatch(kduration) do
d = d + tonumber(match)
line = line:sub(iend + 1) -- keep looking for more
_, iend, match = line:find(kduration)
end
return d * 10