aboutsummaryrefslogtreecommitdiff
path: root/lbuiltin.c
diff options
context:
space:
mode:
Diffstat (limited to 'lbuiltin.c')
-rw-r--r--lbuiltin.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/lbuiltin.c b/lbuiltin.c
index 274e301e..502c70c8 100644
--- a/lbuiltin.c
+++ b/lbuiltin.c
@@ -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
259void 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
265void luaB_collectgarbage (lua_State *L) { 260void 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},