Comparison

util/array.lua @ 7020:6ab9c691c4c6

util.array: Just use table.remove as array:pop()
author Kim Alvefur <zash@zash.se>
date Wed, 23 Dec 2015 08:39:22 +0100
parent 7019:abcd5ec3ee41
child 7699:9c40d0be2295
comparison
equal deleted inserted replaced
7019:abcd5ec3ee41 7020:6ab9c691c4c6
126 function array_methods:push(x) 126 function array_methods:push(x)
127 t_insert(self, x); 127 t_insert(self, x);
128 return self; 128 return self;
129 end 129 end
130 130
131 function array_methods:pop(x) 131 array_methods.pop = t_remove;
132 local v = self[x];
133 t_remove(self, x);
134 return v;
135 end
136 132
137 function array_methods:concat(sep) 133 function array_methods:concat(sep)
138 return t_concat(array.map(self, tostring), sep); 134 return t_concat(array.map(self, tostring), sep);
139 end 135 end
140 136