no more `seterrormethod' function

This commit is contained in:
Roberto Ierusalimschy 2000-04-17 16:23:12 -03:00
parent 71219ccc39
commit 62824137d6
4 changed files with 10 additions and 27 deletions

11
lapi.c
View File

@ -1,5 +1,5 @@
/*
** $Id: lapi.c,v 1.76 2000/03/27 20:10:21 roberto Exp roberto $
** $Id: lapi.c,v 1.77 2000/03/29 20:19:20 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@ -102,15 +102,6 @@ lua_Object lua_settagmethod (lua_State *L, int tag, const char *event) {
}
lua_Object lua_seterrormethod (lua_State *L) {
lua_Object temp;
luaA_checkCargs(L, 1);
temp = lua_getglobal(L, "_ERRORMESSAGE");
lua_setglobal(L, "_ERRORMESSAGE");
return temp;
}
lua_Object lua_gettable (lua_State *L) {
luaA_checkCargs(L, 2);
luaV_gettable(L, L->top--);

View File

@ -1,5 +1,5 @@
/*
** $Id: lbuiltin.c,v 1.104 2000/04/13 18:08:18 roberto Exp roberto $
** $Id: lbuiltin.c,v 1.105 2000/04/14 17:44:20 roberto Exp roberto $
** Built-in functions
** See Copyright Notice in lua.h
*/
@ -256,11 +256,6 @@ void luaB_gettagmethod (lua_State *L) {
luaL_check_string(L, 2)));
}
void luaB_seterrormethod (lua_State *L) {
lua_Object nf = luaL_functionarg(L, 1);
lua_pushobject(L, nf);
lua_pushobject(L, lua_seterrormethod(L));
}
void luaB_collectgarbage (lua_State *L) {
lua_pushnumber(L, lua_collectgarbage(L, luaL_opt_int(L, 1, 0)));
@ -318,8 +313,10 @@ void luaB_call (lua_State *L) {
int narg = (int)getnarg(L, arg);
int i, status;
if (err != LUA_NOOBJECT) { /* set new error method */
lua_Object oldem = lua_getglobal(L, "_ERRORMESSAGE");
lua_pushobject(L, err);
err = lua_seterrormethod(L);
lua_setglobal(L, "_ERRORMESSAGE");
err = oldem;
}
/* push arg[1...n] */
luaD_checkstack(L, narg);
@ -328,7 +325,7 @@ void luaB_call (lua_State *L) {
status = lua_callfunction(L, f);
if (err != LUA_NOOBJECT) { /* restore old error method */
lua_pushobject(L, err);
lua_seterrormethod(L);
lua_setglobal(L, "_ERRORMESSAGE");
}
if (status != 0) { /* error in call? */
if (strchr(options, 'x')) {
@ -632,7 +629,6 @@ static const struct luaL_reg builtin_funcs[] = {
{"rawgettable", luaB_rawgettable},
{"rawsetglobal", luaB_rawsetglobal},
{"rawsettable", luaB_rawsettable},
{"seterrormethod", luaB_seterrormethod},
{"setglobal", luaB_setglobal},
{"settag", luaB_settag},
{"settagmethod", luaB_settagmethod},

View File

@ -1,5 +1,5 @@
/*
** $Id: lbuiltin.h,v 1.5 1999/12/28 19:23:41 roberto Exp roberto $
** $Id: lbuiltin.h,v 1.6 2000/03/03 14:58:26 roberto Exp roberto $
** Built-in functions
** See Copyright Notice in lua.h
*/
@ -32,7 +32,6 @@ void luaB_rawgetglobal (lua_State *L);
void luaB_rawgettable (lua_State *L);
void luaB_rawsetglobal (lua_State *L);
void luaB_rawsettable (lua_State *L);
void luaB_seterrormethod (lua_State *L);
void luaB_setglobal (lua_State *L);
void luaB_settag (lua_State *L);
void luaB_settagmethod (lua_State *L);

9
lua.h
View File

@ -1,5 +1,5 @@
/*
** $Id: lua.h,v 1.46 2000/04/14 17:46:37 roberto Exp roberto $
** $Id: lua.h,v 1.47 2000/04/14 17:48:20 roberto Exp roberto $
** Lua - An Extensible Extension Language
** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
** e-mail: lua@tecgraf.puc-rio.br
@ -11,7 +11,7 @@
#ifndef lua_h
#define lua_h
#define LUA_VERSION "Lua 4.0"
#define LUA_VERSION "Lua 4.0 (alpha)"
#define LUA_COPYRIGHT "Copyright (C) 1994-2000 TeCGraf, PUC-Rio"
#define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo"
@ -112,8 +112,6 @@ lua_Object lua_createtable (lua_State *L);
long lua_collectgarbage (lua_State *L, long limit);
lua_Object lua_seterrormethod (lua_State *L); /* In: new method */
/*
** ===============================================================
@ -207,9 +205,8 @@ extern lua_State *lua_state;
#define lua_unref(ref) (lua_unref)(lua_state, ref)
#define lua_createtable() (lua_createtable)(lua_state)
#define lua_collectgarbage(limit) (lua_collectgarbage)(lua_state, limit)
#define lua_seterrormethod() (lua_seterrormethod)(lua_state)
/*
** the following typecast is a little dirty, but we cannot find another
** the following typecast is a little dirty, but we know of no other
** way to keep compatibility with old definition of `lua_CFunction'
*/
#define lua_pushcclosure(fn,n) \