diff options
Diffstat (limited to 'util/array.lua')
-rw-r--r-- | util/array.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/util/array.lua b/util/array.lua index 5dbd3037..cf586214 100644 --- a/util/array.lua +++ b/util/array.lua @@ -60,6 +60,13 @@ function array_base.sort(outa, ina, ...) return outa; end +function array_base.pluck(outa, ina, key) + for i=1,#ina do + outa[i] = ina[i][key]; + end + return outa; +end + --- These methods only mutate function array_methods:random() return self[math.random(1,#self)]; |