Changeset

6606:96f4a325b534

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Fri, 27 Mar 2015 00:29:35 +0100
parents 6603:e702ae7aa3d9 (current diff) 6605:03a43bf3ecd2 (diff)
children 6609:d2faaaca695d
files
diffstat 1 files changed, 6 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- 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;
 }