From: Vsevolod Stakhov Date: Wed, 11 Dec 2019 18:17:16 +0000 (+0000) Subject: [Minor] Selectors: Sigh, another try to fix .last X-Git-Tag: 2.3~223 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2398d3465cc8b745c22b421564d89a8354f0150f;p=rspamd.git [Minor] Selectors: Sigh, another try to fix .last --- 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', },