MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / io_readline

Function io_readline

third-party/lua-5.1.5/src/liolib.c:391–408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected