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

Function io_open

depends/lua/src/liolib.c:256–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

254
255
256static int io_open (lua_State *L) {
257 const char *filename = luaL_checkstring(L, 1);
258 const char *mode = luaL_optstring(L, 2, "r");
259 LStream *p = newfile(L);
260 const char *md = mode; /* to traverse/check mode */
261 luaL_argcheck(L, l_checkmode(md), 2, "invalid mode");
262 p->f = fopen(filename, mode);
263 return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1;
264}
265
266
267/*

Callers

nothing calls this directly

Calls 3

newfileFunction · 0.85
l_checkmodeFunction · 0.85
luaL_fileresultFunction · 0.85

Tested by

no test coverage detected