aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_ip.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua/lua_ip.c')
-rw-r--r--src/lua/lua_ip.c15
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;
}