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 | |
parent | 5715de344fbb32763995621913cbb3b0455a1fc4 (diff) | |
download | lua-6318de80d3329a627ebeae706b661a73d94e708e.tar.gz lua-6318de80d3329a627ebeae706b661a73d94e708e.tar.bz2 lua-6318de80d3329a627ebeae706b661a73d94e708e.zip |
added 'strip' parameter to lua_dump/string.dump
-rw-r--r-- | lstrlib.c | 5 | ||||
-rw-r--r-- | lua.h | 4 |
2 files changed, 5 insertions, 4 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; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.h,v 1.298 2013/12/30 20:47:58 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.299 2014/02/13 12:11:34 roberto Exp roberto $ |
3 | ** Lua - A Scripting Language | 3 | ** Lua - A Scripting Language |
4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) | 4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) |
5 | ** See Copyright Notice at the end of this file | 5 | ** See Copyright Notice at the end of this file |
@@ -270,7 +270,7 @@ LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, | |||
270 | const char *chunkname, | 270 | const char *chunkname, |
271 | const char *mode); | 271 | const char *mode); |
272 | 272 | ||
273 | LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data); | 273 | LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data, int strip); |
274 | 274 | ||
275 | 275 | ||
276 | /* | 276 | /* |