diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-12-01 13:20:50 +0200 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-12-03 23:30:53 +0200 |
commit | ede05534efb0e4c373e661832de1a146482e1b3a (patch) | |
tree | d9ce213ec2f1d8f40ec35c6c7b26ee41e988f75c /acf2/util.lua | |
parent | 7fc2451896cdda1b44b3d2ef16c563a7a283b7bb (diff) | |
download | aconf-ede05534efb0e4c373e661832de1a146482e1b3a.tar.bz2 aconf-ede05534efb0e4c373e661832de1a146482e1b3a.tar.xz |
reference choice filters, disable choices for client
Diffstat (limited to 'acf2/util.lua')
-rw-r--r-- | acf2/util.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/acf2/util.lua b/acf2/util.lua index a40f7fd..f4c47d6 100644 --- a/acf2/util.lua +++ b/acf2/util.lua @@ -90,4 +90,14 @@ function M.map(func, tbl) return res end +--- select array values satisfying a filter. +-- @param func a function with one argument +-- @param list the array +-- @return the filtered array +function M.filter(func, list) + local res = {} + for _, v in ipairs(list) do if func(v) then table.insert(res, v) end end + return res +end + return M |