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

Function io_lines

third-party/lua-5.3.5/src/liolib.c:356–373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

354
355
356static int io_lines (lua_State *L) {
357 int toclose;
358 if (lua_isnone(L, 1)) lua_pushnil(L); /* at least one argument */
359 if (lua_isnil(L, 1)) { /* no file name? */
360 lua_getfield(L, LUA_REGISTRYINDEX, IO_INPUT); /* get default input */
361 lua_replace(L, 1); /* put it at index 1 */
362 tofile(L); /* check that it's a valid file handle */
363 toclose = 0; /* do not close it after iteration */
364 }
365 else { /* open a new file */
366 const char *filename = luaL_checkstring(L, 1);
367 opencheck(L, filename, "r");
368 lua_replace(L, 1); /* put file at index 1 */
369 toclose = 1; /* close it after iteration */
370 }
371 aux_lines(L, toclose);
372 return 1;
373}
374
375
376/*

Callers

nothing calls this directly

Calls 6

lua_pushnilFunction · 0.70
lua_getfieldFunction · 0.70
tofileFunction · 0.70
opencheckFunction · 0.70
aux_linesFunction · 0.70
lua_replaceFunction · 0.50

Tested by

no test coverage detected