summaryrefslogtreecommitdiff
path: root/src/luajit.c
diff options
context:
space:
mode:
authorMike Pall <mike>2012-10-01 20:45:30 +0200
committerMike Pall <mike>2012-10-01 20:45:30 +0200
commitfcddd5a3a0269f30df0c0da6e9ff89d3e70d0e2c (patch)
tree4bce654a35af804e16eb55324aa92f9ab550a984 /src/luajit.c
parent3ad61689cf11ae73fef5dfe12f7ccb5fe539622e (diff)
downloadluajit-fcddd5a3a0269f30df0c0da6e9ff89d3e70d0e2c.tar.gz
luajit-fcddd5a3a0269f30df0c0da6e9ff89d3e70d0e2c.tar.bz2
luajit-fcddd5a3a0269f30df0c0da6e9ff89d3e70d0e2c.zip
From Lua 5.2: Add luaL_traceback().
Diffstat (limited to 'src/luajit.c')
-rw-r--r--src/luajit.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/src/luajit.c b/src/luajit.c
index 22628aaf..a9476372 100644
--- a/src/luajit.c
+++ b/src/luajit.c
@@ -106,19 +106,7 @@ static int traceback(lua_State *L)
106 return 1; /* Return non-string error object. */ 106 return 1; /* Return non-string error object. */
107 lua_remove(L, 1); /* Replace object by result of __tostring metamethod. */ 107 lua_remove(L, 1); /* Replace object by result of __tostring metamethod. */
108 } 108 }
109 lua_getfield(L, LUA_GLOBALSINDEX, "debug"); 109 luaL_traceback(L, L, lua_tostring(L, 1), 1);
110 if (!lua_istable(L, -1)) {
111 lua_pop(L, 1);
112 return 1;
113 }
114 lua_getfield(L, -1, "traceback");
115 if (!lua_isfunction(L, -1)) {
116 lua_pop(L, 2);
117 return 1;
118 }
119 lua_pushvalue(L, 1); /* Push error message. */
120 lua_pushinteger(L, 2); /* Skip this function and debug.traceback(). */
121 lua_call(L, 2, 1); /* Call debug.traceback(). */
122 return 1; 110 return 1;
123} 111}
124 112