| 3300 | } |
| 3301 | |
| 3302 | COMPAT53_API int luaL_fileresult(lua_State* L, int stat, const char* fname) { |
| 3303 | const char* serr = NULL; |
| 3304 | int en = errno; /* calls to Lua API may change this value */ |
| 3305 | char buf[512] = { 0 }; |
| 3306 | if (stat) { |
| 3307 | lua_pushboolean(L, 1); |
| 3308 | return 1; |
| 3309 | } |
| 3310 | else { |
| 3311 | lua_pushnil(L); |
| 3312 | serr = compat53_strerror(en, buf, sizeof(buf)); |
| 3313 | if (fname) |
| 3314 | lua_pushfstring(L, "%s: %s", fname, serr); |
| 3315 | else |
| 3316 | lua_pushstring(L, serr); |
| 3317 | lua_pushnumber(L, (lua_Number)en); |
| 3318 | return 3; |
| 3319 | } |
| 3320 | } |
| 3321 | |
| 3322 | static int compat53_checkmode(lua_State* L, const char* mode, const char* modename, int err) { |
| 3323 | if (mode && strchr(mode, modename[0]) == NULL) { |
no test coverage detected