| 272 | |
| 273 | |
| 274 | LUALIB_API int luaL_execresult (lua_State *L, int stat) { |
| 275 | const char *what = "exit"; /* type of termination */ |
| 276 | if (stat == -1) /* error? */ |
| 277 | return luaL_fileresult(L, 0, NULL); |
| 278 | else { |
| 279 | l_inspectstat(stat, what); /* interpret result */ |
| 280 | if (*what == 'e' && stat == 0) /* successful termination? */ |
| 281 | lua_pushboolean(L, 1); |
| 282 | else |
| 283 | lua_pushnil(L); |
| 284 | lua_pushstring(L, what); |
| 285 | lua_pushinteger(L, stat); |
| 286 | return 3; /* return true/nil,what,code */ |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | /* }====================================================== */ |
| 291 |
no test coverage detected