| 133 | |
| 134 | |
| 135 | static int report (lua_State *L, int status) { |
| 136 | if (status != LUA_OK && !lua_isnil(L, -1)) { |
| 137 | const char *msg = lua_tostring(L, -1); |
| 138 | if (msg == NULL) msg = "(error object is not a string)"; |
| 139 | l_message(progname, msg); |
| 140 | lua_pop(L, 1); |
| 141 | /* force a complete garbage collection in case of errors */ |
| 142 | lua_gc(L, LUA_GCCOLLECT, 0); |
| 143 | } |
| 144 | return status; |
| 145 | } |
| 146 | |
| 147 | |
| 148 | /* the next function is called unprotected, so it must avoid errors */ |