summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-02-13 15:26:43 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-02-13 15:26:43 +0000
commit5601ec0e3a065ed6b5a5f7a75e40ee350e9a53c5 (patch)
tree6ce6b966f9daaa2e758961a6878e4f8344fae459
parent3103d0192c6982ffca3bf8672c82b3e5318aa5d9 (diff)
downloadrspamd-5601ec0e3a065ed6b5a5f7a75e40ee350e9a53c5.tar.gz
rspamd-5601ec0e3a065ed6b5a5f7a75e40ee350e9a53c5.zip
[Feature] Allow to return options as a table
-rw-r--r--src/lua/lua_config.c11
1 files changed, 11 insertions, 0 deletions
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);
+ }
}
}