Skip to content

Commit

Permalink
update concat logic - now it's returning a new table instead of chang…
Browse files Browse the repository at this point in the history
…es the previous table
  • Loading branch information
EvandroLG committed Oct 14, 2018
1 parent ff2b5d1 commit 3ead9b1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions array.lua
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,17 @@ array = {
raises_error(array, obj, 'concat')
raises_error(array, obj2, 'concat')

local output = {}

for i=1, #obj do
table.insert(output, obj[i])
end

for i=1, #obj2 do
table.insert(obj, obj2[i])
table.insert(output, obj2[i])
end

return obj
return output
end,

uniq = function(obj)
Expand Down

0 comments on commit 3ead9b1

Please sign in to comment.