aboutsummaryrefslogtreecommitdiff
path: root/lua.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-08-26 14:32:05 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-08-26 14:32:05 -0300
commit9273fbd131eb0be7d4e7ca4f44345b41f8a557cf (patch)
tree1503563eb840378013125b4892b7686ac8d8787e /lua.c
parentbe666a662b79e12c300dbf6d74d0a6626acac06f (diff)
downloadlua-9273fbd131eb0be7d4e7ca4f44345b41f8a557cf.tar.gz
lua-9273fbd131eb0be7d4e7ca4f44345b41f8a557cf.tar.bz2
lua-9273fbd131eb0be7d4e7ca4f44345b41f8a557cf.zip
no more 'luaL_get/setfield' (replaced by more direct luaL_findtable)
Diffstat (limited to 'lua.c')
-rw-r--r--lua.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/lua.c b/lua.c
index 28975968..8028d15f 100644
--- a/lua.c
+++ b/lua.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.c,v 1.147 2005/08/25 15:39:16 roberto Exp roberto $ 2** $Id: lua.c,v 1.148 2005/08/25 19:55:38 roberto Exp roberto $
3** Lua stand-alone interpreter 3** Lua stand-alone interpreter
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -71,14 +71,19 @@ static int report (lua_State *L, int status) {
71 71
72 72
73static int traceback (lua_State *L) { 73static int traceback (lua_State *L) {
74 luaL_getfield(L, LUA_GLOBALSINDEX, "debug.traceback"); 74 lua_getfield(L, LUA_GLOBALSINDEX, "debug");
75 if (!lua_isfunction(L, -1)) 75 if (!lua_istable(L, -1)) {
76 lua_pop(L, 1); 76 lua_pop(L, 1);
77 else { 77 return 1;
78 lua_pushvalue(L, 1); /* pass error message */
79 lua_pushinteger(L, 2); /* skip this function and traceback */
80 lua_call(L, 2, 1); /* call debug.traceback */
81 } 78 }
79 lua_getfield(L, -1, "traceback");
80 if (!lua_isfunction(L, -1)) {
81 lua_pop(L, 2);
82 return 1;
83 }
84 lua_pushvalue(L, 1); /* pass error message */
85 lua_pushinteger(L, 2); /* skip this function and traceback */
86 lua_call(L, 2, 1); /* call debug.traceback */
82 return 1; 87 return 1;
83} 88}
84 89