Lua - joypad.setfrommnemonicstr() - catch errors and log to the lua console the error instead of killing the script

This commit is contained in:
adelikat 2014-06-29 13:40:49 +00:00
parent 0c5fda5cb3
commit e475edc3c6
1 changed files with 15 additions and 8 deletions

View File

@ -72,6 +72,8 @@ namespace BizHawk.Client.Common
"sets the given buttons to their provided values for the current frame, string will be interpretted the same way an entry from a movie input log would be"
)]
public void SetFromMnemonicStr(string inputLogEntry)
{
try
{
var lg = Global.MovieSession.MovieControllerInstance();
lg.SetControllersAsMnemonic(inputLogEntry);
@ -86,6 +88,11 @@ namespace BizHawk.Client.Common
Global.LuaAndAdaptor.SetFloat(floatButton, lg.GetFloat(floatButton));
}
}
catch (Exception)
{
Log("invalid mnemonic string: " + inputLogEntry);
}
}
[LuaMethodAttributes(
"set",