diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-21 14:46:13 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-21 14:46:13 +0000 |
commit | 9a66359e75da95ccac88039d156776d90368641b (patch) | |
tree | 28d40fa5ff5c230a9bfc004413f772188413f7d6 /src/lua/lua_common.c | |
parent | c2ff857a70752a83e9d19184d140826fbed9f467 (diff) | |
download | rspamd-9a66359e75da95ccac88039d156776d90368641b.tar.gz rspamd-9a66359e75da95ccac88039d156776d90368641b.zip |
Add lua_fann module
Diffstat (limited to 'src/lua/lua_common.c')
-rw-r--r-- | src/lua/lua_common.c | 19 |
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; +} |