Make luaconsole even easier to use.

This commit is contained in:
2021-11-04 14:49:25 -04:00
parent 0a00ecaaa8
commit 7966707450
4 changed files with 50 additions and 55 deletions

View File

@@ -158,7 +158,8 @@ void TextGame::do_quit_command(const StringVec &cmd) {
}
void TextGame::do_command(const StringVec &words) {
if (words[0] == "lua") do_lua_command(words);
if (words.empty()) return;
else if (words[0] == "lua") do_lua_command(words);
else if (words[0] == "syntax") do_syntax_command(words);
else if (words[0] == "v") do_view_command(words);
else if (words[0] == "m") do_menu_command(words);
@@ -219,18 +220,14 @@ void TextGame::event_update()
std::string line = get_stdio_channel()->in()->readline();
if (line == "") break;
console_.add(line);
const StringVec &words = console_.words();
if (!words.empty()) {
do_command(words);
console_.clear();
channel_printbuffer();
}
get_stdio_channel()->set_prompt(console_.get_prompt());
do_command(console_.get_command());
channel_printbuffer();
check_redirects();
if (actor_id_ == 0) {
stop_driver();
return;
break;
}
get_stdio_channel()->set_prompt(console_.get_prompt());
}
}