]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Allow to return options as a table
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 13 Feb 2017 15:26:43 +0000 (15:26 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 13 Feb 2017 15:26:43 +0000 (15:26 +0000)
src/lua/lua_config.c

index e5866d6ca15603422d4164f394c04e1e2bf5a3a4..b37f7fe0b5a248d023ecd2e7f207ffb717f3feb1 100644 (file)
@@ -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);
+                                               }
                                        }
                                }