MCPcopy Create free account
hub / github.com/defold/defold / io_lines

Function io_lines

engine/lua/src/lua/liolib.c:252–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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