| 659 | } |
| 660 | |
| 661 | static void do_REPL(LuaEnvironment *env, const char *lua) |
| 662 | { |
| 663 | lua_State *L = env->L; |
| 664 | int status; |
| 665 | |
| 666 | lua_settop(L, 0); |
| 667 | lua_pushstring(L, lua); |
| 668 | if ((status = loadline(L)) != -1) { // This is never -1 |
| 669 | if (status == LUA_OK) { |
| 670 | status = env->call(0, LUA_MULTRET); |
| 671 | } |
| 672 | if (status == LUA_OK) |
| 673 | l_print(L); |
| 674 | else |
| 675 | report(L, status); |
| 676 | } |
| 677 | lua_settop(L, 0); /* clear stack */ |
| 678 | return; |
| 679 | } |
| 680 | |
| 681 | static void console_command_REPL(ConsoleServer &cs, u32 client_id, const char *json, void *user_data) |
| 682 | { |
no test coverage detected