| 2783 | } |
| 2784 | |
| 2785 | COMPAT53_API int luaL_fileresult(lua_State *L, int stat, const char *fname) { |
| 2786 | const char *serr = NULL; |
| 2787 | int en = errno; /* calls to Lua API may change this value */ |
| 2788 | char buf[512] = { 0 }; |
| 2789 | if (stat) { |
| 2790 | lua_pushboolean(L, 1); |
| 2791 | return 1; |
| 2792 | } |
| 2793 | else { |
| 2794 | lua_pushnil(L); |
| 2795 | serr = compat53_strerror(en, buf, sizeof(buf)); |
| 2796 | if (fname) |
| 2797 | lua_pushfstring(L, "%s: %s", fname, serr); |
| 2798 | else |
| 2799 | lua_pushstring(L, serr); |
| 2800 | lua_pushnumber(L, (lua_Number)en); |
| 2801 | return 3; |
| 2802 | } |
| 2803 | } |
| 2804 | |
| 2805 | static int compat53_checkmode(lua_State *L, const char *mode, const char *modename, int err) { |
| 2806 | if (mode && strchr(mode, modename[0]) == NULL) { |
no test coverage detected