mirror of
https://github.com/bjc/prosody.git
synced 2025-04-04 13:47:41 +03:00
util.array: Make array:reverse() and array:shuffle() return the array to allow chaining
This commit is contained in:
parent
72331edf3e
commit
38f157315a
1 changed files with 2 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue