MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / io_lines

Function io_lines

Source/Misc/lua/src/lua.c:12162–12177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12160
12161
12162static int io_lines (lua_State *L) {
12163if (lua_isnoneornil(L, 1)) { /* no arguments? */
12164/* will iterate over default input */
12165lua_rawgeti(L, LUA_ENVIRONINDEX, IO_INPUT);
12166return f_lines(L);
12167}
12168else {
12169const char *filename = luaL_checkstring(L, 1);
12170FILE **pf = newfile(L);
12171*pf = fopen(filename, "r");
12172if (*pf == NULL)
12173fileerror(L, 1, filename);
12174aux_lines(L, lua_gettop(L), 1);
12175return 1;
12176}
12177}
12178
12179
12180/*

Callers

nothing calls this directly

Calls 6

lua_rawgetiFunction · 0.85
f_linesFunction · 0.85
newfileFunction · 0.85
fileerrorFunction · 0.85
aux_linesFunction · 0.85
lua_gettopFunction · 0.85

Tested by

no test coverage detected