diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-02-25 11:30:21 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-02-25 11:30:21 -0300 |
commit | 6318de80d3329a627ebeae706b661a73d94e708e (patch) | |
tree | 566dda7121cd443b7d3cc553c7be0b42b33a474b /lstrlib.c | |
parent | 5715de344fbb32763995621913cbb3b0455a1fc4 (diff) | |
download | lua-6318de80d3329a627ebeae706b661a73d94e708e.tar.gz lua-6318de80d3329a627ebeae706b661a73d94e708e.tar.bz2 lua-6318de80d3329a627ebeae706b661a73d94e708e.zip |
added 'strip' parameter to lua_dump/string.dump
Diffstat (limited to 'lstrlib.c')
-rw-r--r-- | lstrlib.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstrlib.c,v 1.184 2014/01/08 18:34:34 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.185 2014/01/09 16:21:28 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 | */ |
@@ -178,10 +178,11 @@ static int writer (lua_State *L, const void *b, size_t size, void *B) { | |||
178 | 178 | ||
179 | static int str_dump (lua_State *L) { | 179 | static int str_dump (lua_State *L) { |
180 | luaL_Buffer b; | 180 | luaL_Buffer b; |
181 | int strip = lua_toboolean(L, 2); | ||
181 | luaL_checktype(L, 1, LUA_TFUNCTION); | 182 | luaL_checktype(L, 1, LUA_TFUNCTION); |
182 | lua_settop(L, 1); | 183 | lua_settop(L, 1); |
183 | luaL_buffinit(L,&b); | 184 | luaL_buffinit(L,&b); |
184 | if (lua_dump(L, writer, &b) != 0) | 185 | if (lua_dump(L, writer, &b, strip) != 0) |
185 | return luaL_error(L, "unable to dump given function"); | 186 | return luaL_error(L, "unable to dump given function"); |
186 | luaL_pushresult(&b); | 187 | luaL_pushresult(&b); |
187 | return 1; | 188 | return 1; |