From 5601ec0e3a065ed6b5a5f7a75e40ee350e9a53c5 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 13 Feb 2017 15:26:43 +0000 Subject: [PATCH] [Feature] Allow to return options as a table --- src/lua/lua_config.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index e5866d6ca..b37f7fe0b 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -943,6 +943,17 @@ lua_metric_symbol_callback (struct rspamd_task *task, gpointer ud) rspamd_task_add_result_option (task, s, opt); } + else if (lua_type (L, i) == LUA_TTABLE) { + lua_pushvalue (L, i); + + for (lua_pushnil (L); lua_next (L, -2); lua_pop (L, 1)) { + const char *opt = lua_tostring (L, -1); + + rspamd_task_add_result_option (task, s, opt); + } + + lua_pop (L, 1); + } } } -- 2.39.5