From 72331edf3e00823a5d5f82f0f370de1d40a2555f Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sat, 20 Jun 2009 22:43:54 +0100 Subject: util.array: Add array:append() method, to append a new array to an existing one --- util/array.lua | 8 ++++++++ 1 file changed, 8 insertions(+) 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 -- cgit v1.2.3