diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-06-19 15:49:40 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-06-19 15:49:40 -0300 |
commit | c5d7ba7347822ab873bd5af9dac2784ccaa10f36 (patch) | |
tree | 676ed4b29dd5e105f895b2232a801dc23bce4cec | |
parent | f84c2ebc4aba7e62618a8177296d95a83167ec06 (diff) | |
download | lua-c5d7ba7347822ab873bd5af9dac2784ccaa10f36.tar.gz lua-c5d7ba7347822ab873bd5af9dac2784ccaa10f36.tar.bz2 lua-c5d7ba7347822ab873bd5af9dac2784ccaa10f36.zip |
dostring has an optional error method argument
-rw-r--r-- | inout.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -5,7 +5,7 @@ | |||
5 | ** Also provides some predefined lua functions. | 5 | ** Also provides some predefined lua functions. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | char *rcs_inout="$Id: inout.c,v 2.63 1997/06/18 20:35:49 roberto Exp roberto $"; | 8 | char *rcs_inout="$Id: inout.c,v 2.64 1997/06/19 18:04:34 roberto Exp roberto $"; |
9 | 9 | ||
10 | #include <stdio.h> | 10 | #include <stdio.h> |
11 | #include <string.h> | 11 | #include <string.h> |
@@ -150,9 +150,18 @@ static void packresults (void) | |||
150 | */ | 150 | */ |
151 | static void lua_internaldostring (void) | 151 | static void lua_internaldostring (void) |
152 | { | 152 | { |
153 | lua_Object err = lua_getparam(2); | ||
154 | if (err != LUA_NOOBJECT) { /* set new error method */ | ||
155 | lua_pushobject(err); | ||
156 | err = lua_seterrormethod(); | ||
157 | } | ||
153 | if (lua_dostring(luaL_check_string(1)) == 0) | 158 | if (lua_dostring(luaL_check_string(1)) == 0) |
154 | if (passresults() == 0) | 159 | if (passresults() == 0) |
155 | lua_pushuserdata(NULL); /* at least one result to signal no errors */ | 160 | lua_pushuserdata(NULL); /* at least one result to signal no errors */ |
161 | if (err != LUA_NOOBJECT) { /* restore old error method */ | ||
162 | lua_pushobject(err); | ||
163 | lua_seterrormethod(); | ||
164 | } | ||
156 | } | 165 | } |
157 | 166 | ||
158 | /* | 167 | /* |