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

Function g_iofile

depends/lua/src/liolib.c:305–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303
304
305static int g_iofile (lua_State *L, const char *f, const char *mode) {
306 if (!lua_isnoneornil(L, 1)) {
307 const char *filename = lua_tostring(L, 1);
308 if (filename)
309 opencheck(L, filename, mode);
310 else {
311 tofile(L); /* check that it's a valid file handle */
312 lua_pushvalue(L, 1);
313 }
314 lua_setfield(L, LUA_REGISTRYINDEX, f);
315 }
316 /* return current value */
317 lua_getfield(L, LUA_REGISTRYINDEX, f);
318 return 1;
319}
320
321
322static int io_input (lua_State *L) {

Callers 2

io_inputFunction · 0.85
io_outputFunction · 0.85

Calls 5

opencheckFunction · 0.85
tofileFunction · 0.85
lua_pushvalueFunction · 0.85
lua_setfieldFunction · 0.85
lua_getfieldFunction · 0.85

Tested by

no test coverage detected