summaryrefslogtreecommitdiff
path: root/lstrlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-11-25 15:33:33 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-11-25 15:33:33 -0200
commit9b1c586b2f5b86173bf0ceca8a0dd84510af9024 (patch)
tree5a53a779e3991c9d2836547ef583aac33683fd81 /lstrlib.c
parentd9340154accd593984fa0d2101fe5f3b63f4c3a2 (diff)
downloadlua-9b1c586b2f5b86173bf0ceca8a0dd84510af9024.tar.gz
lua-9b1c586b2f5b86173bf0ceca8a0dd84510af9024.tar.bz2
lua-9b1c586b2f5b86173bf0ceca8a0dd84510af9024.zip
renaming `stringdump' -> `string.dump'
Diffstat (limited to 'lstrlib.c')
-rw-r--r--lstrlib.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/lstrlib.c b/lstrlib.c
index 824ee36e..1b3e75a7 100644
--- a/lstrlib.c
+++ b/lstrlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstrlib.c,v 1.89 2002/08/23 19:45:24 roberto Exp roberto $ 2** $Id: lstrlib.c,v 1.90 2002/11/14 15:41:38 roberto Exp roberto $
3** Standard library for string operations and pattern-matching 3** Standard library for string operations and pattern-matching
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -117,6 +117,24 @@ static int str_char (lua_State *L) {
117} 117}
118 118
119 119
120static int writer (lua_State *L, const void* b, size_t size, void* B) {
121 (void)L;
122 luaL_addlstring((luaL_Buffer*) B, (const char *)b, size);
123 return 1;
124}
125
126
127static int str_dump (lua_State *L) {
128 luaL_Buffer b;
129 luaL_checktype(L, 1, LUA_TFUNCTION);
130 luaL_buffinit(L,&b);
131 if (!lua_dump(L, writer, &b))
132 luaL_error(L, "unable to dump given function");
133 luaL_pushresult(&b);
134 return 1;
135}
136
137
120 138
121/* 139/*
122** {====================================================== 140** {======================================================
@@ -730,6 +748,7 @@ static const luaL_reg strlib[] = {
730 {"rep", str_rep}, 748 {"rep", str_rep},
731 {"byte", str_byte}, 749 {"byte", str_byte},
732 {"format", str_format}, 750 {"format", str_format},
751 {"dump", str_dump},
733 {"find", str_find}, 752 {"find", str_find},
734 {"gfind", gfind}, 753 {"gfind", gfind},
735 {"gsub", str_gsub}, 754 {"gsub", str_gsub},