From: Vsevolod Stakhov Date: Mon, 13 Feb 2017 15:26:43 +0000 (+0000) Subject: [Feature] Allow to return options as a table X-Git-Tag: 1.5.0~114 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5601ec0e3a065ed6b5a5f7a75e40ee350e9a53c5;p=rspamd.git [Feature] Allow to return options as a table --- 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); + } } }