MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / io_open

Function io_open

third-party/lua-5.2.4/src/liolib.c:226–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224
225
226static int io_open (lua_State *L) {
227 const char *filename = luaL_checkstring(L, 1);
228 const char *mode = luaL_optstring(L, 2, "r");
229 LStream *p = newfile(L);
230 const char *md = mode; /* to traverse/check mode */
231 luaL_argcheck(L, lua_checkmode(md), 2, "invalid mode");
232 p->f = fopen(filename, mode);
233 return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1;
234}
235
236
237/*

Callers

nothing calls this directly

Calls 2

newfileFunction · 0.70
luaL_fileresultFunction · 0.70

Tested by

no test coverage detected