]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Selectors: Sigh, another try to fix .last
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 11 Dec 2019 18:17:16 +0000 (18:17 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 11 Dec 2019 18:17:16 +0000 (18:17 +0000)
lualib/lua_selectors/transforms.lua

index b6fc0a001adc5ac8ed5e46742c0b2e14d7e782fc..b0c912deb61523788c7f2aef7ed4b48ba6867940 100644 (file)
@@ -54,13 +54,7 @@ local transform_function = {
       ['list'] = true,
     },
     ['process'] = function(inp, t)
-      local gen,param,state = fun.iter(inp)
-      local prev_state
-      repeat
-        prev_state = state
-        state = gen(param, state)
-      until state == nil
-      return prev_state,pure_type(t)
+      return fun.nth(fun.length(inp), inp),pure_type(t)
     end,
     ['description'] = 'Returns the last element',
   },