| 243 | |
| 244 | |
| 245 | LUALIB_API int luaL_fileresult (lua_State *L, int stat, const char *fname) { |
| 246 | int en = errno; /* calls to Lua API may change this value */ |
| 247 | if (stat) { |
| 248 | lua_pushboolean(L, 1); |
| 249 | return 1; |
| 250 | } |
| 251 | else { |
| 252 | luaL_pushfail(L); |
| 253 | if (fname) |
| 254 | lua_pushfstring(L, "%s: %s", fname, strerror(en)); |
| 255 | else |
| 256 | lua_pushstring(L, strerror(en)); |
| 257 | lua_pushinteger(L, en); |
| 258 | return 3; |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | |
| 263 | #if !defined(l_inspectstat) /* { */ |
no test coverage detected