MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / newfile

Function newfile

Source/Misc/lua/src/lua.c:12000–12006  ·  view source on GitHub ↗

** 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. */

Source from the content-addressed store, hash-verified

11998** file is not left opened.
11999*/
12000static FILE **newfile (lua_State *L) {
12001FILE **pf = (FILE **)lua_newuserdata(L, sizeof(FILE *));
12002*pf = NULL; /* file handle is currently `closed' */
12003luaL_getmetatable(L, LUA_FILEHANDLE);
12004lua_setmetatable(L, -2);
12005return pf;
12006}
12007
12008
12009/*

Callers 6

io_openFunction · 0.85
io_popenFunction · 0.85
io_tmpfileFunction · 0.85
g_iofileFunction · 0.85
io_linesFunction · 0.85
createstdfileFunction · 0.85

Calls 2

lua_newuserdataFunction · 0.85
lua_setmetatableFunction · 0.85

Tested by

no test coverage detected