Merge 0.10->trunk
authorKim Alvefur <zash@zash.se>
Fri, 27 Mar 2015 00:29:35 +0100
changeset 6609 96f4a325b534
parent 6606 e702ae7aa3d9 (current diff)
parent 6608 03a43bf3ecd2 (diff)
child 6612 d2faaaca695d
Merge 0.10->trunk
--- a/util-src/encodings.c	Thu Mar 26 16:49:03 2015 +0000
+++ b/util-src/encodings.c	Fri Mar 27 00:29:35 2015 +0100
@@ -452,40 +452,30 @@
 
 /***************** end *****************/
 
-static const luaL_Reg Reg[] =
-{
-	{ NULL,		NULL	}
-};
-
 LUALIB_API int luaopen_util_encodings(lua_State *L)
 {
 #ifdef USE_STRINGPREP_ICU
 	init_icu();
 #endif
-	luaL_register(L, "encodings", Reg);
+	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, "utf8");
 	lua_newtable(L);
 	luaL_register(L, NULL, Reg_utf8);
-	lua_settable(L, -3);
+	lua_setfield(L, -2, "utf8");
 
-	lua_pushliteral(L, "version");			/** version */
 	lua_pushliteral(L, "-3.14");
-	lua_settable(L,-3);
+	lua_setfield(L, -2, "version");
 	return 1;
 }