Lua Console: Command window gives slightly more sensible output now.

This commit is contained in:
scepheo 2015-02-08 23:47:15 +00:00
parent 152323d891
commit 48a6686f31
1 changed files with 9 additions and 8 deletions

View File

@ -1133,28 +1133,29 @@ namespace BizHawk.Client.EmuHawk
if (e.KeyCode == Keys.Enter) if (e.KeyCode == Keys.Enter)
{ {
string consoleBeforeCall = OutputBox.Text; string consoleBeforeCall = OutputBox.Text;
// TODO: Maybe make these try-catches more general // TODO: Maybe make these try-catches more general
if (InputBox.Text != "") if (InputBox.Text != "")
{ {
try try
{ {
LuaImp.ExecuteString(InputBox.Text); LuaImp.ExecuteString(string.Format("console.log({0})", InputBox.Text));
// TODO: This isn't exactly optimal
if (OutputBox.Text == consoleBeforeCall)
ConsoleLog("Command successfully executed");
} }
catch (LuaScriptException ex) catch
{ {
try try
{ {
LuaImp.ExecuteString(string.Format("console.log({0})", InputBox.Text)); LuaImp.ExecuteString(InputBox.Text);
if (OutputBox.Text == consoleBeforeCall)
ConsoleLog("Command successfully executed");
} }
catch catch (LuaScriptException ex)
{ {
ConsoleLog(ex.ToString()); ConsoleLog(ex.ToString());
} }
} }
_consoleCommandHistory.Insert(0, InputBox.Text); _consoleCommandHistory.Insert(0, InputBox.Text);
_consoleCommandHistoryIndex = -1; _consoleCommandHistoryIndex = -1;
InputBox.Clear(); InputBox.Clear();