From: Vsevolod Stakhov Date: Wed, 22 Aug 2018 14:50:14 +0000 (+0100) Subject: [Minor] Add id selector transform function X-Git-Tag: 1.8.0~218 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c352b641b1d28aa33817e524936bf08c8134c633;p=thirdparty%2Frspamd.git [Minor] Add id selector transform function --- diff --git a/lualib/lua_selectors.lua b/lualib/lua_selectors.lua index 3cf9a13403..995617ca06 100644 --- a/lualib/lua_selectors.lua +++ b/lualib/lua_selectors.lua @@ -360,6 +360,22 @@ local transform_function = { return inp:sub(start_pos, end_pos), 'string' end }, + -- Drops input value and return values from function's arguments or an empty string + ['id'] = { + ['types'] = { + ['string'] = true + }, + ['map_type'] = 'string', + ['process'] = function(_, _, args) + if args[1] and args[2] then + return fun.map(tostring, args) + elseif args[1] then + return args[1] + end + + return '' + end + }, -- Extracts table value from key-value list ['elt'] = { ['types'] = {