commit 2398d34: [Minor] Selectors: Sigh, another try to fix .last

Vsevolod Stakhov vsevolod at highsecure.ru
Wed Dec 11 18:21:07 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-12-11 18:17:16 +0000
URL: https://github.com/rspamd/rspamd/commit/2398d3465cc8b745c22b421564d89a8354f0150f

[Minor] Selectors: Sigh, another try to fix .last

---
 lualib/lua_selectors/transforms.lua | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/lualib/lua_selectors/transforms.lua b/lualib/lua_selectors/transforms.lua
index b6fc0a001..b0c912deb 100644
--- a/lualib/lua_selectors/transforms.lua
+++ b/lualib/lua_selectors/transforms.lua
@@ -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',
   },


More information about the Commits mailing list