MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / io_open

Function io_open

extlibs/lua/src/liolib.c:257–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

newfileFunction · 0.85
l_checkmodeFunction · 0.85
luaL_fileresultFunction · 0.70

Tested by

no test coverage detected