diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-08-25 13:17:21 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-08-25 13:17:21 +0100 |
commit | c2765b3eb3c3beb3d9f42dc061761df2e300904c (patch) | |
tree | 0f5924f4fd821b16a258465d9dcb0068e5332bf2 /src/lua/lua_ip.c | |
parent | a1be94b4c4b59de216e0b8b721a951b2325f7215 (diff) | |
download | rspamd-c2765b3eb3c3beb3d9f42dc061761df2e300904c.tar.gz rspamd-c2765b3eb3c3beb3d9f42dc061761df2e300904c.zip |
Use modules preload for lua.
Diffstat (limited to 'src/lua/lua_ip.c')
-rw-r--r-- | src/lua/lua_ip.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/lua/lua_ip.c b/src/lua/lua_ip.c index fba1cd1cb..a2ce26130 100644 --- a/src/lua/lua_ip.c +++ b/src/lua/lua_ip.c @@ -460,7 +460,16 @@ rspamd_lua_ip_push_fromstring (lua_State *L, const gchar *ip_str) } } -gint +static gint +lua_load_ip (lua_State * L) +{ + lua_newtable (L); + luaL_register (L, NULL, iplib_f); + + return 1; +} + +void luaopen_ip (lua_State * L) { luaL_newmetatable (L, "rspamd{ip}"); @@ -473,9 +482,7 @@ luaopen_ip (lua_State * L) lua_rawset (L, -3); luaL_register (L, NULL, iplib_m); - luaL_register (L, "rspamd_ip", iplib_f); + rspamd_lua_add_preload (L, "rspamd_ip", lua_load_ip); lua_pop (L, 1); /* remove metatable from stack */ - - return 1; } |