From 6318de80d3329a627ebeae706b661a73d94e708e Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 25 Feb 2014 11:30:21 -0300 Subject: [PATCH] added 'strip' parameter to lua_dump/string.dump --- lstrlib.c | 5 +++-- lua.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lstrlib.c b/lstrlib.c index bd2d7151..9bafa5e4 100644 --- a/lstrlib.c +++ b/lstrlib.c @@ -1,5 +1,5 @@ /* -** $Id: lstrlib.c,v 1.184 2014/01/08 18:34:34 roberto Exp roberto $ +** $Id: lstrlib.c,v 1.185 2014/01/09 16:21:28 roberto Exp roberto $ ** Standard library for string operations and pattern-matching ** See Copyright Notice in lua.h */ @@ -178,10 +178,11 @@ static int writer (lua_State *L, const void *b, size_t size, void *B) { static int str_dump (lua_State *L) { luaL_Buffer b; + int strip = lua_toboolean(L, 2); luaL_checktype(L, 1, LUA_TFUNCTION); lua_settop(L, 1); luaL_buffinit(L,&b); - if (lua_dump(L, writer, &b) != 0) + if (lua_dump(L, writer, &b, strip) != 0) return luaL_error(L, "unable to dump given function"); luaL_pushresult(&b); return 1; diff --git a/lua.h b/lua.h index 95fb3f9c..1738b6d8 100644 --- a/lua.h +++ b/lua.h @@ -1,5 +1,5 @@ /* -** $Id: lua.h,v 1.298 2013/12/30 20:47:58 roberto Exp roberto $ +** $Id: lua.h,v 1.299 2014/02/13 12:11:34 roberto Exp roberto $ ** Lua - A Scripting Language ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) ** 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, const char *chunkname, const char *mode); -LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data); +LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data, int strip); /*