# HG changeset patch # User Kim Alvefur # Date 1410913397 -7200 # Node ID 0e94f89d0e622920ff8a10d7c7e2caa3b17cd639 # Parent 6c8f6364bc48027989f3d2f91b6dc0a8b6860cb7 util-src/*.c: Use the more concise lua_setfield diff -r 6c8f6364bc48 -r 0e94f89d0e62 util-src/encodings.c --- a/util-src/encodings.c Tue Sep 16 21:56:18 2014 +0200 +++ b/util-src/encodings.c Wed Sep 17 02:23:17 2014 +0200 @@ -368,23 +368,19 @@ #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; } diff -r 6c8f6364bc48 -r 0e94f89d0e62 util-src/hashes.c --- a/util-src/hashes.c Tue Sep 16 21:56:18 2014 +0200 +++ b/util-src/hashes.c Wed Sep 17 02:23:17 2014 +0200 @@ -205,8 +205,7 @@ { lua_newtable(L); luaL_register(L, NULL, Reg); - lua_pushliteral(L, "version"); /** version */ lua_pushliteral(L, "-3.14"); - lua_settable(L,-3); + lua_setfield(L, -2, "version"); return 1; } diff -r 6c8f6364bc48 -r 0e94f89d0e62 util-src/signal.c --- a/util-src/signal.c Tue Sep 16 21:56:18 2014 +0200 +++ b/util-src/signal.c Wed Sep 17 02:23:17 2014 +0200 @@ -391,7 +391,7 @@ /* put the signals inside the library table too, * they are only a reference */ lua_pushstring(L, LUA_SIGNAL); - lua_createtable(L, 0, 0); + lua_newtable(L); while (lua_signals[i].name != NULL) { diff -r 6c8f6364bc48 -r 0e94f89d0e62 util-src/windows.c --- a/util-src/windows.c Tue Sep 16 21:56:18 2014 +0200 +++ b/util-src/windows.c Wed Sep 17 02:23:17 2014 +0200 @@ -83,8 +83,7 @@ LUALIB_API int luaopen_util_windows(lua_State *L) { lua_newtable(L); luaL_register(L, NULL, Reg); - lua_pushliteral(L, "version"); /** version */ lua_pushliteral(L, "-3.14"); - lua_settable(L,-3); + lua_setfield(L, -2, "version"); return 1; }