diff options
Diffstat (limited to 'src/lua/lua_upstream.c')
-rw-r--r-- | src/lua/lua_upstream.c | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/src/lua/lua_upstream.c b/src/lua/lua_upstream.c index 3c4f3f4c3..7ba77839f 100644 --- a/src/lua/lua_upstream.c +++ b/src/lua/lua_upstream.c @@ -569,30 +569,10 @@ lua_load_upstream_list (lua_State * L) void luaopen_upstream (lua_State * L) { - luaL_newmetatable (L, "rspamd{upstream_list}"); - lua_pushstring (L, "__index"); - lua_pushvalue (L, -2); - lua_settable (L, -3); - - lua_pushstring (L, "class"); - lua_pushstring (L, "rspamd{upstream_list}"); - lua_rawset (L, -3); - - luaL_register (L, NULL, upstream_list_m); + rspamd_lua_new_class (L, "rspamd{upstream_list}", upstream_list_m); + lua_pop (L, 1); rspamd_lua_add_preload (L, "rspamd_upstream_list", lua_load_upstream_list); - lua_pop (L, 1); /* remove metatable from stack */ - - luaL_newmetatable (L, "rspamd{upstream}"); - lua_pushstring (L, "__index"); - lua_pushvalue (L, -2); - lua_settable (L, -3); - - lua_pushstring (L, "class"); - lua_pushstring (L, "rspamd{upstream}"); - lua_rawset (L, -3); - - luaL_register (L, NULL, upstream_m); - - lua_pop (L, 1); /* remove metatable from stack */ + rspamd_lua_new_class (L, "rspamd{upstream}", upstream_m); + lua_pop (L, 1); } |