** Do the REPL: repeatedly read (load) a line, evaluate (call) it, and ** print any results. */
| 675 | ** print any results. |
| 676 | */ |
| 677 | static void doREPL (lua_State *L) { |
| 678 | int status; |
| 679 | const char *oldprogname = progname; |
| 680 | progname = NULL; /* no 'progname' on errors in interactive mode */ |
| 681 | lua_initreadline(L); |
| 682 | while ((status = loadline(L)) != -1) { |
| 683 | if (status == LUA_OK) |
| 684 | status = docall(L, 0, LUA_MULTRET); |
| 685 | if (status == LUA_OK) l_print(L); |
| 686 | else report(L, status); |
| 687 | } |
| 688 | lua_settop(L, 0); /* clear stack */ |
| 689 | lua_writeline(); |
| 690 | progname = oldprogname; |
| 691 | } |
| 692 | |
| 693 | /* }================================================================== */ |
| 694 |
no test coverage detected