From 9273fbd131eb0be7d4e7ca4f44345b41f8a557cf Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 26 Aug 2005 14:32:05 -0300 Subject: no more 'luaL_get/setfield' (replaced by more direct luaL_findtable) --- lua.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'lua.c') diff --git a/lua.c b/lua.c index 28975968..8028d15f 100644 --- a/lua.c +++ b/lua.c @@ -1,5 +1,5 @@ /* -** $Id: lua.c,v 1.147 2005/08/25 15:39:16 roberto Exp roberto $ +** $Id: lua.c,v 1.148 2005/08/25 19:55:38 roberto Exp roberto $ ** Lua stand-alone interpreter ** See Copyright Notice in lua.h */ @@ -71,14 +71,19 @@ static int report (lua_State *L, int status) { static int traceback (lua_State *L) { - luaL_getfield(L, LUA_GLOBALSINDEX, "debug.traceback"); - if (!lua_isfunction(L, -1)) + lua_getfield(L, LUA_GLOBALSINDEX, "debug"); + if (!lua_istable(L, -1)) { lua_pop(L, 1); - else { - lua_pushvalue(L, 1); /* pass error message */ - lua_pushinteger(L, 2); /* skip this function and traceback */ - lua_call(L, 2, 1); /* call debug.traceback */ + return 1; } + lua_getfield(L, -1, "traceback"); + if (!lua_isfunction(L, -1)) { + lua_pop(L, 2); + return 1; + } + lua_pushvalue(L, 1); /* pass error message */ + lua_pushinteger(L, 2); /* skip this function and traceback */ + lua_call(L, 2, 1); /* call debug.traceback */ return 1; } -- cgit v1.2.3-55-g6feb