summaryrefslogtreecommitdiffstats
path: root/lualib/lua_selectors.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lualib/lua_selectors.lua')
-rw-r--r--lualib/lua_selectors.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/lualib/lua_selectors.lua b/lualib/lua_selectors.lua
index 66f2906d1..cef2d163f 100644
--- a/lualib/lua_selectors.lua
+++ b/lualib/lua_selectors.lua
@@ -329,6 +329,24 @@ local transform_function = {
end,
['description'] = 'Returns the nth element',
},
+ ['take_n'] = {
+ ['types'] = {
+ ['list'] = true,
+ },
+ ['process'] = function(inp, t, args)
+ return fun.take_n(tonumber(args[1]) or 1, inp),t
+ end,
+ ['description'] = 'Returns the n first elements',
+ },
+ ['drop_n'] = {
+ ['types'] = {
+ ['list'] = true,
+ },
+ ['process'] = function(inp, t, args)
+ return fun.drop_n(tonumber(args[1]) or 1, inp),t
+ end,
+ ['description'] = 'Returns list without the first n elements',
+ },
-- Joins strings into a single string using separator in the argument
['join'] = {
['types'] = {