Changeset

6605:03a43bf3ecd2

Merge with merge
author Kim Alvefur <zash@zash.se>
date Fri, 27 Mar 2015 00:28:16 +0100
parents 6604:478308ee29dd (diff) 6602:61b6a4fc65f1 (current diff)
children 6606:96f4a325b534 6608:b6e558febb7a
files net/http/server.lua util-src/encodings.c
diffstat 1 files changed, 6 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/util-src/encodings.c	Thu Mar 26 16:48:39 2015 +0000
+++ b/util-src/encodings.c	Fri Mar 27 00:28:16 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;
 }