aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-02-04 16:59:31 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-02-04 16:59:31 -0200
commitbdfab46c220681f4dc0663bbce4026f4bbada00b (patch)
tree974d8d55f61392b90ee8eca1af15bc5c0d225a68
parent568794956025183fc9a9b79e0c818a885e3d0aeb (diff)
downloadlua-bdfab46c220681f4dc0663bbce4026f4bbada00b.tar.gz
lua-bdfab46c220681f4dc0663bbce4026f4bbada00b.tar.bz2
lua-bdfab46c220681f4dc0663bbce4026f4bbada00b.zip
"errorim" now is _ERRORMESSAGE.
-rw-r--r--ltm.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ltm.c b/ltm.c
index fdb8f024..bc9d0faa 100644
--- a/ltm.c
+++ b/ltm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltm.c,v 1.19 1999/01/13 19:08:10 roberto Exp roberto $ 2** $Id: ltm.c,v 1.20 1999/01/15 13:11:57 roberto Exp roberto $
3** Tag methods 3** Tag methods
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -164,6 +164,7 @@ char *luaT_travtagmethods (int (*fn)(TObject *)) { /* ORDER IM */
164#ifdef LUA_COMPAT2_5 164#ifdef LUA_COMPAT2_5
165 165
166#include "lapi.h" 166#include "lapi.h"
167#include "lstring.h"
167 168
168static void errorFB (void) 169static void errorFB (void)
169{ 170{
@@ -199,11 +200,13 @@ void luaT_setfallback (void) {
199 lua_Object func = lua_getparam(2); 200 lua_Object func = lua_getparam(2);
200 luaL_arg_check(lua_isfunction(func), 2, "function expected"); 201 luaL_arg_check(lua_isfunction(func), 2, "function expected");
201 switch (luaL_findstring(name, oldnames)) { 202 switch (luaL_findstring(name, oldnames)) {
202 case 0: /* old error fallback */ 203 case 0: { /* old error fallback */
203 oldfunc = L->errorim; 204 TObject *em = &(luaS_new("_ERRORMESSAGE")->u.s.globalval);
204 L->errorim = *luaA_Address(func); 205 oldfunc = *em;
206 *em = *luaA_Address(func);
205 replace = errorFB; 207 replace = errorFB;
206 break; 208 break;
209 }
207 case 1: /* old getglobal fallback */ 210 case 1: /* old getglobal fallback */
208 oldfunc = *luaT_getim(LUA_T_NIL, IM_GETGLOBAL); 211 oldfunc = *luaT_getim(LUA_T_NIL, IM_GETGLOBAL);
209 *luaT_getim(LUA_T_NIL, IM_GETGLOBAL) = *luaA_Address(func); 212 *luaT_getim(LUA_T_NIL, IM_GETGLOBAL) = *luaA_Address(func);