git.s-ol.nu mmm / a67038a
fix yieldable_gsub s-ol 1 year, 11 months ago
1 changed file(s) with 6 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
2929 str = str\gsub '%%', '%%|'
3030
3131 matches = {}
32 str\gsub pat, (...) ->
32 str, cnt = str\gsub pat, (...) ->
3333 table.insert matches, { ... }
3434 "%#{#matches}"
3535
3636 for match in *matches
3737 match.replacement = f table.unpack match
3838
39 str\gsub '%%(%d+)', (i) -> matches[i].replacement
39 str = str\gsub '%%(%d+)', (i) ->
40 i = tonumber i
41 matches[i].replacement
4042
4143 -- unescape escaped percent signs
42 str\gsub '%%|', '%%'
44 str = str\gsub '%%|', '%%'
45 str, cnt
4346
4447 -- list of converts, editors
4548 -- converts each have