diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-04-17 16:23:12 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-04-17 16:23:12 -0300 |
commit | 62824137d65aec32654f0cd91f900b1d470fa959 (patch) | |
tree | 4ff631e648d4172d7aa958f30085fcb5bc6c880a | |
parent | 71219ccc3905931c5afb2646ff8c5de4145428f5 (diff) | |
download | lua-62824137d65aec32654f0cd91f900b1d470fa959.tar.gz lua-62824137d65aec32654f0cd91f900b1d470fa959.tar.bz2 lua-62824137d65aec32654f0cd91f900b1d470fa959.zip |
no more `seterrormethod' function
-rw-r--r-- | lapi.c | 11 | ||||
-rw-r--r-- | lbuiltin.c | 14 | ||||
-rw-r--r-- | lbuiltin.h | 3 | ||||
-rw-r--r-- | lua.h | 9 |
4 files changed, 10 insertions, 27 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 1.76 2000/03/27 20:10:21 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.77 2000/03/29 20:19:20 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 | */ |
@@ -102,15 +102,6 @@ lua_Object lua_settagmethod (lua_State *L, int tag, const char *event) { | |||
102 | } | 102 | } |
103 | 103 | ||
104 | 104 | ||
105 | lua_Object lua_seterrormethod (lua_State *L) { | ||
106 | lua_Object temp; | ||
107 | luaA_checkCargs(L, 1); | ||
108 | temp = lua_getglobal(L, "_ERRORMESSAGE"); | ||
109 | lua_setglobal(L, "_ERRORMESSAGE"); | ||
110 | return temp; | ||
111 | } | ||
112 | |||
113 | |||
114 | lua_Object lua_gettable (lua_State *L) { | 105 | lua_Object lua_gettable (lua_State *L) { |
115 | luaA_checkCargs(L, 2); | 106 | luaA_checkCargs(L, 2); |
116 | luaV_gettable(L, L->top--); | 107 | luaV_gettable(L, L->top--); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbuiltin.c,v 1.104 2000/04/13 18:08:18 roberto Exp roberto $ | 2 | ** $Id: lbuiltin.c,v 1.105 2000/04/14 17:44:20 roberto Exp roberto $ |
3 | ** Built-in functions | 3 | ** Built-in functions |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -256,11 +256,6 @@ void luaB_gettagmethod (lua_State *L) { | |||
256 | luaL_check_string(L, 2))); | 256 | luaL_check_string(L, 2))); |
257 | } | 257 | } |
258 | 258 | ||
259 | void luaB_seterrormethod (lua_State *L) { | ||
260 | lua_Object nf = luaL_functionarg(L, 1); | ||
261 | lua_pushobject(L, nf); | ||
262 | lua_pushobject(L, lua_seterrormethod(L)); | ||
263 | } | ||
264 | 259 | ||
265 | void luaB_collectgarbage (lua_State *L) { | 260 | void luaB_collectgarbage (lua_State *L) { |
266 | lua_pushnumber(L, lua_collectgarbage(L, luaL_opt_int(L, 1, 0))); | 261 | lua_pushnumber(L, lua_collectgarbage(L, luaL_opt_int(L, 1, 0))); |
@@ -318,8 +313,10 @@ void luaB_call (lua_State *L) { | |||
318 | int narg = (int)getnarg(L, arg); | 313 | int narg = (int)getnarg(L, arg); |
319 | int i, status; | 314 | int i, status; |
320 | if (err != LUA_NOOBJECT) { /* set new error method */ | 315 | if (err != LUA_NOOBJECT) { /* set new error method */ |
316 | lua_Object oldem = lua_getglobal(L, "_ERRORMESSAGE"); | ||
321 | lua_pushobject(L, err); | 317 | lua_pushobject(L, err); |
322 | err = lua_seterrormethod(L); | 318 | lua_setglobal(L, "_ERRORMESSAGE"); |
319 | err = oldem; | ||
323 | } | 320 | } |
324 | /* push arg[1...n] */ | 321 | /* push arg[1...n] */ |
325 | luaD_checkstack(L, narg); | 322 | luaD_checkstack(L, narg); |
@@ -328,7 +325,7 @@ void luaB_call (lua_State *L) { | |||
328 | status = lua_callfunction(L, f); | 325 | status = lua_callfunction(L, f); |
329 | if (err != LUA_NOOBJECT) { /* restore old error method */ | 326 | if (err != LUA_NOOBJECT) { /* restore old error method */ |
330 | lua_pushobject(L, err); | 327 | lua_pushobject(L, err); |
331 | lua_seterrormethod(L); | 328 | lua_setglobal(L, "_ERRORMESSAGE"); |
332 | } | 329 | } |
333 | if (status != 0) { /* error in call? */ | 330 | if (status != 0) { /* error in call? */ |
334 | if (strchr(options, 'x')) { | 331 | if (strchr(options, 'x')) { |
@@ -632,7 +629,6 @@ static const struct luaL_reg builtin_funcs[] = { | |||
632 | {"rawgettable", luaB_rawgettable}, | 629 | {"rawgettable", luaB_rawgettable}, |
633 | {"rawsetglobal", luaB_rawsetglobal}, | 630 | {"rawsetglobal", luaB_rawsetglobal}, |
634 | {"rawsettable", luaB_rawsettable}, | 631 | {"rawsettable", luaB_rawsettable}, |
635 | {"seterrormethod", luaB_seterrormethod}, | ||
636 | {"setglobal", luaB_setglobal}, | 632 | {"setglobal", luaB_setglobal}, |
637 | {"settag", luaB_settag}, | 633 | {"settag", luaB_settag}, |
638 | {"settagmethod", luaB_settagmethod}, | 634 | {"settagmethod", luaB_settagmethod}, |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbuiltin.h,v 1.5 1999/12/28 19:23:41 roberto Exp roberto $ | 2 | ** $Id: lbuiltin.h,v 1.6 2000/03/03 14:58:26 roberto Exp roberto $ |
3 | ** Built-in functions | 3 | ** Built-in functions |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -32,7 +32,6 @@ void luaB_rawgetglobal (lua_State *L); | |||
32 | void luaB_rawgettable (lua_State *L); | 32 | void luaB_rawgettable (lua_State *L); |
33 | void luaB_rawsetglobal (lua_State *L); | 33 | void luaB_rawsetglobal (lua_State *L); |
34 | void luaB_rawsettable (lua_State *L); | 34 | void luaB_rawsettable (lua_State *L); |
35 | void luaB_seterrormethod (lua_State *L); | ||
36 | void luaB_setglobal (lua_State *L); | 35 | void luaB_setglobal (lua_State *L); |
37 | void luaB_settag (lua_State *L); | 36 | void luaB_settag (lua_State *L); |
38 | void luaB_settagmethod (lua_State *L); | 37 | void luaB_settagmethod (lua_State *L); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.h,v 1.46 2000/04/14 17:46:37 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.47 2000/04/14 17:48:20 roberto Exp roberto $ |
3 | ** Lua - An Extensible Extension Language | 3 | ** Lua - An Extensible Extension Language |
4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil | 4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil |
5 | ** e-mail: lua@tecgraf.puc-rio.br | 5 | ** e-mail: lua@tecgraf.puc-rio.br |
@@ -11,7 +11,7 @@ | |||
11 | #ifndef lua_h | 11 | #ifndef lua_h |
12 | #define lua_h | 12 | #define lua_h |
13 | 13 | ||
14 | #define LUA_VERSION "Lua 4.0" | 14 | #define LUA_VERSION "Lua 4.0 (alpha)" |
15 | #define LUA_COPYRIGHT "Copyright (C) 1994-2000 TeCGraf, PUC-Rio" | 15 | #define LUA_COPYRIGHT "Copyright (C) 1994-2000 TeCGraf, PUC-Rio" |
16 | #define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo" | 16 | #define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo" |
17 | 17 | ||
@@ -112,8 +112,6 @@ lua_Object lua_createtable (lua_State *L); | |||
112 | long lua_collectgarbage (lua_State *L, long limit); | 112 | long lua_collectgarbage (lua_State *L, long limit); |
113 | 113 | ||
114 | 114 | ||
115 | lua_Object lua_seterrormethod (lua_State *L); /* In: new method */ | ||
116 | |||
117 | 115 | ||
118 | /* | 116 | /* |
119 | ** =============================================================== | 117 | ** =============================================================== |
@@ -207,9 +205,8 @@ extern lua_State *lua_state; | |||
207 | #define lua_unref(ref) (lua_unref)(lua_state, ref) | 205 | #define lua_unref(ref) (lua_unref)(lua_state, ref) |
208 | #define lua_createtable() (lua_createtable)(lua_state) | 206 | #define lua_createtable() (lua_createtable)(lua_state) |
209 | #define lua_collectgarbage(limit) (lua_collectgarbage)(lua_state, limit) | 207 | #define lua_collectgarbage(limit) (lua_collectgarbage)(lua_state, limit) |
210 | #define lua_seterrormethod() (lua_seterrormethod)(lua_state) | ||
211 | /* | 208 | /* |
212 | ** the following typecast is a little dirty, but we cannot find another | 209 | ** the following typecast is a little dirty, but we know of no other |
213 | ** way to keep compatibility with old definition of `lua_CFunction' | 210 | ** way to keep compatibility with old definition of `lua_CFunction' |
214 | */ | 211 | */ |
215 | #define lua_pushcclosure(fn,n) \ | 212 | #define lua_pushcclosure(fn,n) \ |