projects
/
prosody.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
eb6e876
)
util.array: Make array:reverse() and array:shuffle() return the array to allow chaining
author
Matthew Wild
<mwild1@gmail.com>
Sat, 20 Jun 2009 21:45:07 +0000
(22:45 +0100)
committer
Matthew Wild
<mwild1@gmail.com>
Sat, 20 Jun 2009 21:45:07 +0000
(22:45 +0100)
util/array.lua
patch
|
blob
|
history
diff --git
a/util/array.lua
b/util/array.lua
index 11ff651caf95c61fc79dc53fd0100ebea6e1d23a..8b9102bf13da9ec8f08c5310a61350733e6e7199 100644
(file)
--- a/
util/array.lua
+++ b/
util/array.lua
@@
-42,6
+42,7
@@
function array:shuffle()
local r = math.random(i,len);
self[i], self[r] = self[r], self[i];
end
+ return self;
end
function array:reverse()
@@
-50,6
+51,7
@@
function array:reverse()
self:push(self[i]);
self:pop(i);
end
+ return self;
end
function array:append(array)