]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Allow to extract ucl_object from lua using common API
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 10 May 2016 13:37:55 +0000 (14:37 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 10 May 2016 13:37:55 +0000 (14:37 +0100)
src/lua/lua_common.c

index 63aab5830cbe80ec58cd671bea4d8828d66568ca..768b65bfce45da9570c7ca9043b60bc1226335d3 100644 (file)
@@ -673,6 +673,20 @@ rspamd_lua_parse_table_arguments (lua_State *L, gint pos,
                                        return FALSE;
                                }
 
+                               if (is_table) {
+                                       lua_pop (L, 1);
+                               }
+                               break;
+                       case 'u':
+                               if (t != LUA_TNONE) {
+                                       *(va_arg (ap, ucl_object_t **)) = ucl_object_lua_import (L,
+                                                       idx);
+                               }
+                               else {
+                                       failed = TRUE;
+                                       *(va_arg (ap, ucl_object_t **)) = NULL;
+                               }
+
                                if (is_table) {
                                        lua_pop (L, 1);
                                }