** Message handler used to run all chunks */
| 110 | ** Message handler used to run all chunks |
| 111 | */ |
| 112 | static int msghandler (lua_State *L) { |
| 113 | const char *msg = lua_tostring(L, 1); |
| 114 | if (msg == NULL) { /* is error object not a string? */ |
| 115 | if (luaL_callmeta(L, 1, "__tostring") && /* does it have a metamethod */ |
| 116 | lua_type(L, -1) == LUA_TSTRING) /* that produces a string? */ |
| 117 | return 1; /* that is the message */ |
| 118 | else |
| 119 | msg = lua_pushfstring(L, "(error object is a %s value)", |
| 120 | luaL_typename(L, 1)); |
| 121 | } |
| 122 | luaL_traceback(L, L, msg, 1); /* append a standard traceback */ |
| 123 | return 1; /* return the traceback */ |
| 124 | } |
| 125 | |
| 126 | |
| 127 | /* |
nothing calls this directly
no test coverage detected