summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-06-19 15:49:40 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-06-19 15:49:40 -0300
commitc5d7ba7347822ab873bd5af9dac2784ccaa10f36 (patch)
tree676ed4b29dd5e105f895b2232a801dc23bce4cec
parentf84c2ebc4aba7e62618a8177296d95a83167ec06 (diff)
downloadlua-github-c5d7ba7347822ab873bd5af9dac2784ccaa10f36.tar.gz
dostring has an optional error method argument
-rw-r--r--inout.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/inout.c b/inout.c
index 1319506e..7d9d5cea 100644
--- a/inout.c
+++ b/inout.c
@@ -5,7 +5,7 @@
** Also provides some predefined lua functions.
*/
-char *rcs_inout="$Id: inout.c,v 2.63 1997/06/18 20:35:49 roberto Exp roberto $";
+char *rcs_inout="$Id: inout.c,v 2.64 1997/06/19 18:04:34 roberto Exp roberto $";
#include <stdio.h>
#include <string.h>
@@ -150,9 +150,18 @@ static void packresults (void)
*/
static void lua_internaldostring (void)
{
+ lua_Object err = lua_getparam(2);
+ if (err != LUA_NOOBJECT) { /* set new error method */
+ lua_pushobject(err);
+ err = lua_seterrormethod();
+ }
if (lua_dostring(luaL_check_string(1)) == 0)
if (passresults() == 0)
lua_pushuserdata(NULL); /* at least one result to signal no errors */
+ if (err != LUA_NOOBJECT) { /* restore old error method */
+ lua_pushobject(err);
+ lua_seterrormethod();
+ }
}
/*