aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_common.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-04-14 15:25:34 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-04-14 15:25:34 +0100
commit5d7a33f313ec86598c38f40c535e77ce8eed4729 (patch)
tree9cc06c27f5c2c49582706ba5b801cfdf72f4c294 /src/lua/lua_common.c
parentb80e8b8477dd019ad9384541d499b57f5432393a (diff)
downloadrspamd-5d7a33f313ec86598c38f40c535e77ce8eed4729.tar.gz
rspamd-5d7a33f313ec86598c38f40c535e77ce8eed4729.zip
[Minor] Add some missing types and docs to rspamd_lua_parse_table_arguments
Diffstat (limited to 'src/lua/lua_common.c')
-rw-r--r--src/lua/lua_common.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c
index 8a562f7b3..2be91140a 100644
--- a/src/lua/lua_common.c
+++ b/src/lua/lua_common.c
@@ -1449,6 +1449,38 @@ rspamd_lua_parse_table_arguments (lua_State *L, gint pos,
}
break;
+ case 'i':
+ if (t == LUA_TNUMBER) {
+ *(va_arg (ap, gint32 *)) = lua_tointeger (L, idx);
+ }
+ else if (t == LUA_TNIL || t == LUA_TNONE) {
+ failed = TRUE;
+ if (how != RSPAMD_LUA_PARSE_ARGUMENTS_IGNORE_MISSING) {
+ *(va_arg (ap, gint32 *)) = 0;
+ }
+ else {
+ (void)va_arg (ap, gint32 *);
+ }
+ }
+ else {
+ g_set_error (err,
+ lua_error_quark (),
+ 1,
+ "bad type for key:"
+ " %.*s: '%s', '%s' is expected",
+ (gint) keylen,
+ key,
+ lua_typename (L, lua_type (L, idx)),
+ "int64");
+ va_end (ap);
+
+ return FALSE;
+ }
+ if (is_table) {
+ lua_pop (L, 1);
+ }
+ break;
+
case 'F':
if (t == LUA_TFUNCTION) {
if (!is_table) {