"errorim" now is _ERRORMESSAGE.

This commit is contained in:
Roberto Ierusalimschy 1999-02-04 16:59:31 -02:00
parent 5687949560
commit bdfab46c22
1 changed files with 7 additions and 4 deletions

11
ltm.c
View File

@ -1,5 +1,5 @@
/* /*
** $Id: ltm.c,v 1.19 1999/01/13 19:08:10 roberto Exp roberto $ ** $Id: ltm.c,v 1.20 1999/01/15 13:11:57 roberto Exp roberto $
** Tag methods ** Tag methods
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -164,6 +164,7 @@ char *luaT_travtagmethods (int (*fn)(TObject *)) { /* ORDER IM */
#ifdef LUA_COMPAT2_5 #ifdef LUA_COMPAT2_5
#include "lapi.h" #include "lapi.h"
#include "lstring.h"
static void errorFB (void) static void errorFB (void)
{ {
@ -199,11 +200,13 @@ void luaT_setfallback (void) {
lua_Object func = lua_getparam(2); lua_Object func = lua_getparam(2);
luaL_arg_check(lua_isfunction(func), 2, "function expected"); luaL_arg_check(lua_isfunction(func), 2, "function expected");
switch (luaL_findstring(name, oldnames)) { switch (luaL_findstring(name, oldnames)) {
case 0: /* old error fallback */ case 0: { /* old error fallback */
oldfunc = L->errorim; TObject *em = &(luaS_new("_ERRORMESSAGE")->u.s.globalval);
L->errorim = *luaA_Address(func); oldfunc = *em;
*em = *luaA_Address(func);
replace = errorFB; replace = errorFB;
break; break;
}
case 1: /* old getglobal fallback */ case 1: /* old getglobal fallback */
oldfunc = *luaT_getim(LUA_T_NIL, IM_GETGLOBAL); oldfunc = *luaT_getim(LUA_T_NIL, IM_GETGLOBAL);
*luaT_getim(LUA_T_NIL, IM_GETGLOBAL) = *luaA_Address(func); *luaT_getim(LUA_T_NIL, IM_GETGLOBAL) = *luaA_Address(func);