aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-06-20 22:43:54 +0100
committerMatthew Wild <mwild1@gmail.com>2009-06-20 22:43:54 +0100
commit72331edf3e00823a5d5f82f0f370de1d40a2555f (patch)
tree3ac657c0c7c8b11a3f6a180e19998f4eddc20566 /util
parent0119d748022e9afcd03285870ae2c3985cb105d5 (diff)
downloadprosody-72331edf3e00823a5d5f82f0f370de1d40a2555f.tar.gz
prosody-72331edf3e00823a5d5f82f0f370de1d40a2555f.zip
util.array: Add array:append() method, to append a new array to an existing one
Diffstat (limited to 'util')
-rw-r--r--util/array.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/util/array.lua b/util/array.lua
index 072b24a7..11ff651c 100644
--- a/util/array.lua
+++ b/util/array.lua
@@ -52,6 +52,14 @@ function array:reverse()
end
end
+function array:append(array)
+ local len,len2 = #self, #array;
+ for i=1,len2 do
+ self[len+i] = array[i];
+ end
+ return self;
+end
+
function array.collect(f, s, var)
local t, var = {};
while true do