| 286 | |
| 287 | |
| 288 | LUALIB_API int luaL_execresult (lua_State *L, int stat) { |
| 289 | if (stat != 0 && errno != 0) /* error with an 'errno'? */ |
| 290 | return luaL_fileresult(L, 0, NULL); |
| 291 | else { |
| 292 | const char *what = "exit"; /* type of termination */ |
| 293 | l_inspectstat(stat, what); /* interpret result */ |
| 294 | if (*what == 'e' && stat == 0) /* successful termination? */ |
| 295 | lua_pushboolean(L, 1); |
| 296 | else |
| 297 | luaL_pushfail(L); |
| 298 | lua_pushstring(L, what); |
| 299 | lua_pushinteger(L, stat); |
| 300 | return 3; /* return true/fail,what,code */ |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | /* }====================================================== */ |
| 305 |
no test coverage detected