Changeset

6412:0e94f89d0e62

util-src/*.c: Use the more concise lua_setfield
author Kim Alvefur <zash@zash.se>
date Wed, 17 Sep 2014 02:23:17 +0200
parents 6411:6c8f6364bc48
children 6413:a552f4170aed
files util-src/encodings.c util-src/hashes.c util-src/signal.c util-src/windows.c
diffstat 4 files changed, 7 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- 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;
 }
--- 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;
 }
--- 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)
   {
--- 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;
 }