summaryrefslogtreecommitdiff
path: root/lua.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-04-22 11:40:50 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-04-22 11:40:50 -0300
commitee4859b3e3db6c1a3223669d15538b3852ca4791 (patch)
treea9a9532c03f0a9bc58599e34457cb618aa5f11f2 /lua.c
parentf388ee4a822b3d8027ed7c28aa21e9406e4a11eb (diff)
downloadlua-ee4859b3e3db6c1a3223669d15538b3852ca4791.tar.gz
lua-ee4859b3e3db6c1a3223669d15538b3852ca4791.tar.bz2
lua-ee4859b3e3db6c1a3223669d15538b3852ca4791.zip
new way to handle errors (temporary version)
Diffstat (limited to 'lua.c')
-rw-r--r--lua.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lua.c b/lua.c
index 03cfbb9d..fbeaf239 100644
--- a/lua.c
+++ b/lua.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.c,v 1.81 2002/04/05 18:54:31 roberto Exp roberto $ 2** $Id: lua.c,v 1.82 2002/04/09 20:19:06 roberto Exp roberto $
3** Lua stand-alone interpreter 3** Lua stand-alone interpreter
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -200,16 +200,16 @@ static int trap_eof (lua_State *l) {
200 200
201 201
202static int load_string (void) { 202static int load_string (void) {
203 lua_getglobal(L, LUA_ERRORMESSAGE); 203 lua_getglobal(L, "_ERRORMESSAGE");
204 lua_pushvalue(L, 1); 204 lua_pushvalue(L, 1);
205 lua_setglobal(L, LUA_ERRORMESSAGE); 205 lua_setglobal(L, "_ERRORMESSAGE");
206 incomplete = 0; 206 incomplete = 0;
207 for (;;) { /* repeat until gets a complete line */ 207 for (;;) { /* repeat until gets a complete line */
208 int result; 208 int result;
209 char *buffer = readline(get_prompt(incomplete)); 209 char *buffer = readline(get_prompt(incomplete));
210 if (buffer == NULL) { /* input end? */ 210 if (buffer == NULL) { /* input end? */
211 lua_settop(L, 2); 211 lua_settop(L, 2);
212 lua_setglobal(L, LUA_ERRORMESSAGE); 212 lua_setglobal(L, "_ERRORMESSAGE");
213 return 0; 213 return 0;
214 } 214 }
215 if (!incomplete && buffer[0] == '=') { 215 if (!incomplete && buffer[0] == '=') {
@@ -225,7 +225,7 @@ static int load_string (void) {
225 lua_remove(L, 3); 225 lua_remove(L, 3);
226 if (result == 0) { 226 if (result == 0) {
227 lua_insert(L, 2); /* swap compiled chunk with old _ERRORMESSAGE */ 227 lua_insert(L, 2); /* swap compiled chunk with old _ERRORMESSAGE */
228 lua_setglobal(L, LUA_ERRORMESSAGE); /* restore old _ERRORMESSAGE */ 228 lua_setglobal(L, "_ERRORMESSAGE"); /* restore old _ERRORMESSAGE */
229 return 1; 229 return 1;
230 } 230 }
231 else 231 else