Software /
code /
prosody
Comparison
util/array.lua @ 4448:d745f4c28294
util.array: Make array:push() chainable.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Fri, 09 Dec 2011 11:57:14 +0500 |
parent | 4440:c60ed6732b34 |
child | 4449:ca74d8ed1a15 |
comparison
equal
deleted
inserted
replaced
4447:57d7362a9312 | 4448:d745f4c28294 |
---|---|
103 return self; | 103 return self; |
104 end | 104 end |
105 | 105 |
106 function array_methods:push(x) | 106 function array_methods:push(x) |
107 table.insert(self, x); | 107 table.insert(self, x); |
108 return self; | |
108 end | 109 end |
109 | 110 |
110 function array_methods:pop(x) | 111 function array_methods:pop(x) |
111 local v = self[x]; | 112 local v = self[x]; |
112 table.remove(self, x); | 113 table.remove(self, x); |