| 205 | |
| 206 | |
| 207 | LUALIB_API int luaL_fileresult (lua_State *L, int stat, const char *fname) { |
| 208 | int en = errno; /* calls to Lua API may change this value */ |
| 209 | if (stat) { |
| 210 | lua_pushboolean(L, 1); |
| 211 | return 1; |
| 212 | } |
| 213 | else { |
| 214 | lua_pushnil(L); |
| 215 | if (fname) |
| 216 | lua_pushfstring(L, "%s: %s", fname, strerror(en)); |
| 217 | else |
| 218 | lua_pushstring(L, strerror(en)); |
| 219 | lua_pushinteger(L, en); |
| 220 | return 3; |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | |
| 225 | #if !defined(inspectstat) /* { */ |
no test coverage detected