| 106 | } |
| 107 | |
| 108 | static int msghandler(lua_State *L) |
| 109 | { |
| 110 | const char *msg = lua_tostring(L, 1); |
| 111 | if (msg == NULL) { /* is error object not a string? */ |
| 112 | if (luaL_callmeta(L, 1, "__tostring") && /* does it have a metamethod */ |
| 113 | lua_type(L, -1) == LUA_TSTRING) /* that produces a string? */ |
| 114 | return 1; /* that is the message */ |
| 115 | else |
| 116 | msg = lua_pushfstring(L, "(error object is a %s value)", |
| 117 | luaL_typename(L, 1)); |
| 118 | } |
| 119 | #if CROWN_USE_LUAJIT |
| 120 | luaL_traceback(L, L, msg, 1); /* append a standard traceback */ |
| 121 | #else |
| 122 | lua_pushstring(L, "No traceback"); |
| 123 | #endif |
| 124 | return 1; /* return the traceback */ |
| 125 | } |
| 126 | |
| 127 | /* |
| 128 | ** Prints (calling the Lua 'print' function) any values on the stack |
nothing calls this directly
no test coverage detected