MCPcopy Create free account
hub / github.com/DFHack/dfhack / newprefile

Function newprefile

depends/lua/src/liolib.c:188–193  ·  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 ** handle is in a consistent state. */

Source from the content-addressed store, hash-verified

186** handle is in a consistent state.
187*/
188static LStream *newprefile (lua_State *L) {
189 LStream *p = (LStream *)lua_newuserdata(L, sizeof(LStream));
190 p->closef = NULL; /* mark file handle as 'closed' */
191 luaL_setmetatable(L, LUA_FILEHANDLE);
192 return p;
193}
194
195
196/*

Callers 3

newfileFunction · 0.85
io_popenFunction · 0.85
createstdfileFunction · 0.85

Calls 2

lua_newuserdataFunction · 0.85
luaL_setmetatableFunction · 0.85

Tested by

no test coverage detected