util-src/*.c: Use the more concise lua_setfield
[prosody.git] / util-src / encodings.c
index 3a0749494e68d8e94287625cd7d3396c023694cc..fb8385517c15ef87afc3b3a5ca5800ae6802a56d 100644 (file)
@@ -368,23 +368,19 @@ LUALIB_API int luaopen_util_encodings(lua_State *L)
 #endif
        lua_newtable(L);
 
-       lua_pushliteral(L, "base64");
        lua_newtable(L);
        luaL_register(L, NULL, Reg_base64);
-       lua_settable(L,-3);
+       lua_setfield(L, -2, "base64");
 
-       lua_pushliteral(L, "stringprep");
        lua_newtable(L);
        luaL_register(L, NULL, Reg_stringprep);
-       lua_settable(L,-3);
+       lua_setfield(L, -2, "stringprep");
 
-       lua_pushliteral(L, "idna");
        lua_newtable(L);
        luaL_register(L, NULL, Reg_idna);
-       lua_settable(L,-3);
+       lua_setfield(L, -2, "idna");
 
-       lua_pushliteral(L, "version");                  /** version */
        lua_pushliteral(L, "-3.14");
-       lua_settable(L,-3);
+       lua_setfield(L, -2, "version");
        return 1;
 }