MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / io_open

Function io_open

3rd/lua-5.4.3/src/liolib.c:269–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267
268
269static int io_open (lua_State *L) {
270 const char *filename = luaL_checkstring(L, 1);
271 const char *mode = luaL_optstring(L, 2, "r");
272 LStream *p = newfile(L);
273 const char *md = mode; /* to traverse/check mode */
274 luaL_argcheck(L, l_checkmode(md), 2, "invalid mode");
275 p->f = fopen(filename, mode);
276 return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1;
277}
278
279
280/*

Callers

nothing calls this directly

Calls 3

newfileFunction · 0.85
l_checkmodeFunction · 0.85
luaL_fileresultFunction · 0.85

Tested by

no test coverage detected