Lua - joypad.setfrommnemonicstr() - catch errors and log to the lua console the error instead of killing the script
This commit is contained in:
parent
0c5fda5cb3
commit
e475edc3c6
|
@ -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"
|
"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)
|
public void SetFromMnemonicStr(string inputLogEntry)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var lg = Global.MovieSession.MovieControllerInstance();
|
var lg = Global.MovieSession.MovieControllerInstance();
|
||||||
lg.SetControllersAsMnemonic(inputLogEntry);
|
lg.SetControllersAsMnemonic(inputLogEntry);
|
||||||
|
@ -86,6 +88,11 @@ namespace BizHawk.Client.Common
|
||||||
Global.LuaAndAdaptor.SetFloat(floatButton, lg.GetFloat(floatButton));
|
Global.LuaAndAdaptor.SetFloat(floatButton, lg.GetFloat(floatButton));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
Log("invalid mnemonic string: " + inputLogEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[LuaMethodAttributes(
|
[LuaMethodAttributes(
|
||||||
"set",
|
"set",
|
||||||
|
|
Loading…
Reference in New Issue