Added support for Lua scripts via the command line

This commit is contained in:
Maximilian Peters 2017-07-06 01:06:31 +02:00 committed by GitHub
parent 170381597b
commit bbcea298d7
1 changed files with 24 additions and 1 deletions

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
@ -160,6 +160,9 @@ namespace BizHawk.Client.EmuHawk
string cmdDumpType = null;
string cmdDumpName = null;
bool startFullscreen = false;
string luaScript = null;
bool luaConsole = false;
for (int i = 0; i < args.Length; i++)
{
// For some reason sometimes visual studio will pass this to us on the commandline. it makes no sense.
@ -222,6 +225,15 @@ namespace BizHawk.Client.EmuHawk
{
startFullscreen = true;
}
else if (arg.StartsWith("--lua="))
{
luaScript = arg.Substring(arg.IndexOf('=') + 1);
luaConsole = true;
}
else if (arg.StartsWith("--luaconsole"))
{
luaConsole = true;
}
else
{
cmdRom = arg;
@ -447,6 +459,17 @@ namespace BizHawk.Client.EmuHawk
}
}
//start Lua Console if requested in the command line arguments
if (luaConsole)
{
GlobalWin.Tools.Load<LuaConsole>();
}
//load Lua Script if requested in the command line arguments
if (luaScript != null)
{
GlobalWin.Tools.LuaConsole.LoadLuaFile(luaScript);
}
GlobalWin.Tools.AutoLoad();
if (Global.Config.RecentWatches.AutoLoad)