** Do the REPL: repeatedly read (load) a line, evaluate (call) it, and ** print any results. */
| 429 | ** print any results. |
| 430 | */ |
| 431 | void luaL_doREPL(lua_State *L) |
| 432 | { |
| 433 | int status; |
| 434 | const char *oldprogname = progname; |
| 435 | progname = nullptr; /* no 'progname' on errors in interactive mode */ |
| 436 | int *state = thinkyoung::lua::lib::get_repl_state(L); |
| 437 | while ((status = loadline(L)) != -1 && *state > 0) { |
| 438 | if (status == LUA_OK) |
| 439 | status = docall(L, 0, LUA_MULTRET); |
| 440 | if (status == LUA_OK) l_print(L); |
| 441 | else report(L, status); |
| 442 | if (*state <= 0) |
| 443 | break; |
| 444 | } |
| 445 | lua_settop(L, 0); /* clear stack */ |
| 446 | luaL_writeline(L); |
| 447 | progname = oldprogname; |
| 448 | } |
no test coverage detected