| 74 | |
| 75 | |
| 76 | static int traceback (lua_State *L) { |
| 77 | if (!lua_isstring(L, 1)) /* 'message' not a string? */ |
| 78 | return 1; /* keep it intact */ |
| 79 | lua_getfield(L, LUA_GLOBALSINDEX, "debug"); |
| 80 | if (!lua_istable(L, -1)) { |
| 81 | lua_pop(L, 1); |
| 82 | return 1; |
| 83 | } |
| 84 | lua_getfield(L, -1, "traceback"); |
| 85 | if (!lua_isfunction(L, -1)) { |
| 86 | lua_pop(L, 2); |
| 87 | return 1; |
| 88 | } |
| 89 | lua_pushvalue(L, 1); /* pass error message */ |
| 90 | lua_pushinteger(L, 2); /* skip this function and traceback */ |
| 91 | lua_call(L, 2, 1); /* call debug.traceback */ |
| 92 | return 1; |
| 93 | } |
| 94 | |
| 95 | |
| 96 | static int docall (lua_State *L, int narg, int clear) { |
nothing calls this directly
no test coverage detected