Skip to content

Commit

Permalink
red: sub speedup
Browse files Browse the repository at this point in the history
  • Loading branch information
hugeping committed Nov 14, 2023
1 parent b8b0f27 commit 07d724a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions data/lib/red/proc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,12 @@ function proc.sub(w, text, glob)
if not b then
return text:findln(a)
end
local t = ''
local t = {}
for l in text:lines(true) do
l = l:gsub(a, b)
t = t .. l
table.insert(t, l)
end
return t
return table.concat(t, '')
end, a[1], a[2])
end

Expand Down

0 comments on commit 07d724a

Please sign in to comment.