MCPcopy Create free account
hub / github.com/F-Stack/f-stack / io_lines

Function io_lines

app/redis-6.2.6/deps/lua/src/liolib.c:248–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246
247
248static int io_lines (lua_State *L) {
249 if (lua_isnoneornil(L, 1)) { /* no arguments? */
250 /* will iterate over default input */
251 lua_rawgeti(L, LUA_ENVIRONINDEX, IO_INPUT);
252 return f_lines(L);
253 }
254 else {
255 const char *filename = luaL_checkstring(L, 1);
256 FILE **pf = newfile(L);
257 *pf = fopen(filename, "r");
258 if (*pf == NULL)
259 fileerror(L, 1, filename);
260 aux_lines(L, lua_gettop(L), 1);
261 return 1;
262 }
263}
264
265
266/*

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected