Software /
code /
prosody
Changeset
1371:9e45bdf55353
util.array: Add array:append() method, to append a new array to an existing one
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 20 Jun 2009 22:43:54 +0100 |
parents | 1370:3a467e6885f0 |
children | 1372:3b13bb57002e |
files | util/array.lua |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/util/array.lua Sat Jun 20 18:18:38 2009 +0500 +++ b/util/array.lua Sat Jun 20 22:43:54 2009 +0100 @@ -52,6 +52,14 @@ 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