Skip to content

Commit

Permalink
Lua Console: Print an error message when not opening the console beca…
Browse files Browse the repository at this point in the history
…use :debug hasn't been run.

(cherry-picked from commit 012142a)
  • Loading branch information
jostephd authored and Pentarctagon committed Oct 7, 2018
1 parent f761493 commit 5301d07
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/gui/dialogs/lua_interpreter.cpp
Expand Up @@ -30,6 +30,7 @@
#include "game_config.hpp"
#include "game_errors.hpp"
#include "gettext.hpp"
#include "play_controller.hpp"
#include "resources.hpp" //for help fetching lua kernel pointers
#include "scripting/plugins/manager.hpp" //needed for the WHICH_KERNEL version of display
#include "scripting/game_lua_kernel.hpp" //needed for the WHICH_KERNEL version of display
Expand Down Expand Up @@ -685,6 +686,9 @@ void lua_interpreter::controller::search(int direction)
void lua_interpreter::display(lua_kernel_base * lk) {
#ifndef ALWAYS_HAVE_LUA_CONSOLE
if(!game_config::debug) {
display_chat_manager& chat_man = resources::controller->get_display().get_chat_manager();
const std::string& message = _("The lua console can only be used in debug mode! (Run ':debug' first)");
chat_man.add_chat_message(time(nullptr), _("lua console"), 0, message, events::chat_handler::MESSAGE_PRIVATE, false);
return;
}
#endif
Expand Down

0 comments on commit 5301d07

Please sign in to comment.