Software /
code /
prosody
Comparison
util/array.lua @ 13245:ffe4adbd2af9
util.array: Fix new() library function
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 22 Jul 2023 16:31:05 +0200 |
parent | 13141:451cb119026e |
child | 13248:db433ed3135c |
comparison
equal
deleted
inserted
replaced
13244:2902c54f45a6 | 13245:ffe4adbd2af9 |
---|---|
34 t = self.collect(t, _s, _var); | 34 t = self.collect(t, _s, _var); |
35 end | 35 end |
36 return setmetatable(t or {}, array_mt); | 36 return setmetatable(t or {}, array_mt); |
37 end | 37 end |
38 | 38 |
39 array.new = new_array; | 39 function array.new(t) |
40 return setmetatable(t or {}, array_mt); | |
41 end | |
40 | 42 |
41 function array_mt.__add(a1, a2) | 43 function array_mt.__add(a1, a2) |
42 local res = new_array(); | 44 local res = new_array(); |
43 return res:append(a1):append(a2); | 45 return res:append(a1):append(a2); |
44 end | 46 end |