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

Function io_readline

engine/lua/src/lua/liolib.c:392–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

390
391
392static int io_readline (lua_State *L) {
393 FILE *f = *(FILE **)lua_touserdata(L, lua_upvalueindex(1));
394 int sucess;
395 if (f == NULL) /* file is already closed? */
396 luaL_error(L, "file is already closed");
397 sucess = read_line(L, f);
398 if (ferror(f))
399 return luaL_error(L, "%s", strerror(errno));
400 if (sucess) return 1;
401 else { /* EOF */
402 if (lua_toboolean(L, lua_upvalueindex(2))) { /* generator created file? */
403 lua_settop(L, 0);
404 lua_pushvalue(L, lua_upvalueindex(1));
405 aux_close(L); /* close it */
406 }
407 return 0;
408 }
409}
410
411/* }====================================================== */
412

Callers

nothing calls this directly

Calls 7

lua_touserdataFunction · 0.85
luaL_errorFunction · 0.85
read_lineFunction · 0.85
lua_tobooleanFunction · 0.85
lua_settopFunction · 0.85
lua_pushvalueFunction · 0.85
aux_closeFunction · 0.85

Tested by

no test coverage detected