File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change 1+ #include " config.h"
12#include " lua-utils.hpp"
23#include " format.hpp"
34
@@ -158,11 +159,16 @@ static int pcall_error_traceback_handler(lua_State *lua_state)
158159// wrapper function for lua_pcall to include a stack traceback
159160int luaX_pcall (lua_State *lua_state, int narg, int nres)
160161{
162+ // Lua 5.1 doesn't support luaL_traceback, unless LuaJIT is used
163+ #if LUA_VERSION_NUM < 502 && !defined(HAVE_LUAJIT)
164+ int const status = lua_pcall (lua_state, narg, nres, 0 );
165+ #else
161166 int const base = lua_gettop (lua_state) - narg; // function index
162167 lua_pushcfunction (lua_state,
163168 pcall_error_traceback_handler); // push message handler
164169 lua_insert (lua_state, base); // put it under function and args
165170 int const status = lua_pcall (lua_state, narg, nres, base);
166171 lua_remove (lua_state, base); // remove message handler from the stack
172+ #endif
167173 return status;
168174}
You can’t perform that action at this time.
0 commit comments