commit 9b1c586b2f5b86173bf0ceca8a0dd84510af9024
parent d9340154accd593984fa0d2101fe5f3b63f4c3a2
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Mon, 25 Nov 2002 15:33:11 -0200
renaming `stringdump' -> `string.dump'
Diffstat:
2 files changed, 21 insertions(+), 22 deletions(-)
diff --git a/lbaselib.c b/lbaselib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lbaselib.c,v 1.108 2002/11/18 11:20:01 roberto Exp roberto $
+** $Id: lbaselib.c,v 1.109 2002/11/22 18:01:46 roberto Exp roberto $
** Basic library
** See Copyright Notice in lua.h
*/
@@ -256,25 +256,6 @@ static int luaB_loadstring (lua_State *L) {
}
-static int writer (lua_State *L, const void* b, size_t size, void* B) {
- (void)L;
- luaL_addlstring((luaL_Buffer*) B, (const char *)b, size);
- return 1;
-}
-
-
-static int luaB_stringdump (lua_State *L) {
- luaL_Buffer b;
- luaL_checktype(L, 1, LUA_TFUNCTION);
- luaL_buffinit(L,&b);
- if (!lua_dump(L, writer, &b))
- luaL_error(L, "unable to dump given function");
- luaL_pushresult(&b);
- return 1;
-}
-
-
-
static int luaB_loadfile (lua_State *L) {
const char *fname = luaL_optstring(L, 1, NULL);
return passresults(L, luaL_loadfile(L, fname));
@@ -526,7 +507,6 @@ static const luaL_reg base_funcs[] = {
{"collectgarbage", luaB_collectgarbage},
{"gcinfo", luaB_gcinfo},
{"loadfile", luaB_loadfile},
- {"stringdump", luaB_stringdump},
{"dofile", luaB_dofile},
{"loadstring", luaB_loadstring},
{"require", luaB_require},
diff --git a/lstrlib.c b/lstrlib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lstrlib.c,v 1.89 2002/08/23 19:45:24 roberto Exp roberto $
+** $Id: lstrlib.c,v 1.90 2002/11/14 15:41:38 roberto Exp roberto $
** Standard library for string operations and pattern-matching
** See Copyright Notice in lua.h
*/
@@ -117,6 +117,24 @@ static int str_char (lua_State *L) {
}
+static int writer (lua_State *L, const void* b, size_t size, void* B) {
+ (void)L;
+ luaL_addlstring((luaL_Buffer*) B, (const char *)b, size);
+ return 1;
+}
+
+
+static int str_dump (lua_State *L) {
+ luaL_Buffer b;
+ luaL_checktype(L, 1, LUA_TFUNCTION);
+ luaL_buffinit(L,&b);
+ if (!lua_dump(L, writer, &b))
+ luaL_error(L, "unable to dump given function");
+ luaL_pushresult(&b);
+ return 1;
+}
+
+
/*
** {======================================================
@@ -730,6 +748,7 @@ static const luaL_reg strlib[] = {
{"rep", str_rep},
{"byte", str_byte},
{"format", str_format},
+ {"dump", str_dump},
{"find", str_find},
{"gfind", gfind},
{"gsub", str_gsub},