** Message handler used to run all chunks */
| 131 | ** Message handler used to run all chunks |
| 132 | */ |
| 133 | static int msghandler (lua_State *L) { |
| 134 | const char *msg = lua_tostring(L, 1); |
| 135 | if (msg == NULL) { /* is error object not a string? */ |
| 136 | if (luaL_callmeta(L, 1, "__tostring") && /* does it have a metamethod */ |
| 137 | lua_type(L, -1) == LUA_TSTRING) /* that produces a string? */ |
| 138 | return 1; /* that is the message */ |
| 139 | else |
| 140 | msg = lua_pushfstring(L, "(error object is a %s value)", |
| 141 | luaL_typename(L, 1)); |
| 142 | } |
| 143 | luaL_traceback(L, L, msg, 1); /* append a standard traceback */ |
| 144 | return 1; /* return the traceback */ |
| 145 | } |
| 146 | |
| 147 | |
| 148 | /* |
nothing calls this directly
no test coverage detected