| 28 | |
| 29 | |
| 30 | static int pushresult (lua_State *L, int i, const char *filename) { |
| 31 | int en = errno; /* calls to Lua API may change this value */ |
| 32 | if (i) { |
| 33 | lua_pushboolean(L, 1); |
| 34 | return 1; |
| 35 | } |
| 36 | else { |
| 37 | lua_pushnil(L); |
| 38 | if (filename) |
| 39 | lua_pushfstring(L, "%s: %s", filename, strerror(en)); |
| 40 | else |
| 41 | lua_pushfstring(L, "%s", strerror(en)); |
| 42 | lua_pushinteger(L, en); |
| 43 | return 3; |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | |
| 48 | static void fileerror (lua_State *L, int arg, const char *filename) { |
no test coverage detected