aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua/lua_common.c')
-rw-r--r--src/lua/lua_common.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c
index 0cbec0408..e475ace83 100644
--- a/src/lua/lua_common.c
+++ b/src/lua/lua_common.c
@@ -247,6 +247,7 @@ rspamd_lua_init ()
luaopen_util (L);
luaopen_tcp (L);
luaopen_html (L);
+ luaopen_fann (L);
rspamd_lua_add_preload (L, "ucl", luaopen_ucl);
@@ -944,3 +945,21 @@ rspamd_lua_traceback (lua_State *L)
return 1;
}
+
+guint
+rspamd_lua_table_size (lua_State *L, gint tbl_pos)
+{
+ guint tbl_size = 0;
+
+ if (!lua_istable (L, tbl_pos)) {
+ return 0;
+ }
+
+#if LUA_VERSION_NUM >= 502
+ tbl_size = lua_rawlen (L, tbl_pos);
+#else
+ tbl_size = lua_objlen (L, tbl_pos);
+#endif
+
+ return tbl_size;
+}