summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2020-10-17 18:55:01 +0000
committerVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2020-10-17 18:55:01 +0000
commitd814357ddfa2b889af285775425221d1f9801396 (patch)
tree9fee48112986453c97327fcb2c9c7e338c8d79fd
parentd93396600f25f3f8058a995753ca9277dd9a2ae9 (diff)
parentc2fe5fe95668ed34695cf9a0784e34c939148910 (diff)
downloadpipeworks-d814357ddfa2b889af285775425221d1f9801396.tar
pipeworks-d814357ddfa2b889af285775425221d1f9801396.tar.gz
pipeworks-d814357ddfa2b889af285775425221d1f9801396.tar.bz2
pipeworks-d814357ddfa2b889af285775425221d1f9801396.tar.xz
pipeworks-d814357ddfa2b889af285775425221d1f9801396.zip
Merge branch 'm_table_extends_clean' into 'master'
Make pipeworks.table_extend easier to read See merge request VanessaE/pipeworks!29
-rw-r--r--common.lua7
1 files changed, 3 insertions, 4 deletions
diff --git a/common.lua b/common.lua
index 0f8c34c..a2a8cea 100644
--- a/common.lua
+++ b/common.lua
@@ -86,10 +86,9 @@ function pipeworks.table_contains(tbl, element)
end
function pipeworks.table_extend(tbl, tbl2)
- local index = #tbl + 1
- for _, elt in ipairs(tbl2) do
- tbl[index] = elt
- index = index + 1
+ local oldlength = #tbl
+ for i = 1,#tbl2 do
+ tbl[oldlength + i] = tbl2[i]
end
end