** When creating file handles, always creates a `closed' file handle ** before opening the actual file; so, if there is a memory error, the ** file is not left opened. */
| 84 | ** file is not left opened. |
| 85 | */ |
| 86 | static FILE **newfile (lua_State *L) { |
| 87 | FILE **pf = (FILE **)lua_newuserdata(L, sizeof(FILE *)); |
| 88 | *pf = NULL; /* file handle is currently `closed' */ |
| 89 | luaL_getmetatable(L, LUA_FILEHANDLE); |
| 90 | lua_setmetatable(L, -2); |
| 91 | return pf; |
| 92 | } |
| 93 | |
| 94 | |
| 95 | /* |
no test coverage detected