Switched accumulate() to return a table, not a string.
This commit is contained in:
parent
f1d4a568a3
commit
75c6755d32
@ -127,15 +127,12 @@ local function remove_from_list(list, item)
|
|||||||
for i=N-deleted+1,N do list[i] = nil end
|
for i=N-deleted+1,N do list[i] = nil end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function accumulate(glue, co)
|
local function accumulate(co)
|
||||||
if co == nil then
|
|
||||||
glue, co = "", glue
|
|
||||||
end
|
|
||||||
local bits = {}
|
local bits = {}
|
||||||
for bit in coroutine.wrap(co) do
|
for bit in coroutine.wrap(co) do
|
||||||
bits[#bits+1] = bit
|
bits[#bits+1] = bit
|
||||||
end
|
end
|
||||||
return table.concat(bits, glue)
|
return bits
|
||||||
end
|
end
|
||||||
|
|
||||||
local function nth_to_last(list, n)
|
local function nth_to_last(list, n)
|
||||||
|
Loading…
Reference in New Issue
Block a user