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

Function io_readline

Source/Misc/lua/src/lua.c:12302–12319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12300
12301
12302static int io_readline (lua_State *L) {
12303FILE *f = *(FILE **)lua_touserdata(L, lua_upvalueindex(1));
12304int sucess;
12305if (f == NULL) /* file is already closed? */
12306luaL_error(L, "file is already closed");
12307sucess = read_line(L, f);
12308if (ferror(f))
12309return luaL_error(L, "%s", strerror(errno));
12310if (sucess) return 1;
12311else { /* EOF */
12312if (lua_toboolean(L, lua_upvalueindex(2))) { /* generator created file? */
12313lua_settop(L, 0);
12314lua_pushvalue(L, lua_upvalueindex(1));
12315aux_close(L); /* close it */
12316}
12317return 0;
12318}
12319}
12320
12321/* }====================================================== */
12322

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