diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-08-21 14:43:44 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-08-21 14:43:44 -0300 |
| commit | cc117253c83ec32d226a8f2226d5ca144804f873 (patch) | |
| tree | 46551b01d3febf98d65d55276d5831a75e2e0062 /lapi.c | |
| parent | 8e226e6a09390a80fde98f192833fc85a5537376 (diff) | |
| download | lua-cc117253c83ec32d226a8f2226d5ca144804f873.tar.gz lua-cc117253c83ec32d226a8f2226d5ca144804f873.tar.bz2 lua-cc117253c83ec32d226a8f2226d5ca144804f873.zip | |
new implementation for error handling: on error, function _ERRORMESSAGE
is called, which in turn calls _ALERT to write a message to stderr.
Diffstat (limited to 'lapi.c')
| -rw-r--r-- | lapi.c | 17 |
1 files changed, 8 insertions, 9 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 1.25 1998/06/05 22:17:44 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.26 1998/07/12 16:16:02 roberto Exp roberto $ |
| 3 | ** Lua API | 3 | ** Lua API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -29,9 +29,8 @@ char lua_ident[] = "$Lua: " LUA_VERSION " " LUA_COPYRIGHT " $\n" | |||
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | TObject *luaA_Address (lua_Object o) | 32 | TObject *luaA_Address (lua_Object o) { |
| 33 | { | 33 | return (o != LUA_NOOBJECT) ? Address(o) : NULL; |
| 34 | return Address(o); | ||
| 35 | } | 34 | } |
| 36 | 35 | ||
| 37 | 36 | ||
| @@ -150,12 +149,12 @@ lua_Object lua_settagmethod (int tag, char *event) | |||
| 150 | } | 149 | } |
| 151 | 150 | ||
| 152 | 151 | ||
| 153 | lua_Object lua_seterrormethod (void) | 152 | lua_Object lua_seterrormethod (void) { |
| 154 | { | 153 | lua_Object temp; |
| 155 | TObject temp = L->errorim; | ||
| 156 | checkCparams(1); | 154 | checkCparams(1); |
| 157 | L->errorim = *(--L->stack.top); | 155 | temp = lua_getglobal("_ERRORMESSAGE"); |
| 158 | return put_luaObject(&temp); | 156 | lua_setglobal("_ERRORMESSAGE"); |
| 157 | return temp; | ||
| 159 | } | 158 | } |
| 160 | 159 | ||
| 161 | 160 | ||
