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