diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.Joypad.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.Joypad.cs index 6fa147ba76..ab56e20875 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.Joypad.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.Joypad.cs @@ -18,18 +18,18 @@ namespace BizHawk.Client.Common "get", "returns a lua table of the controller buttons pressed. If supplied, it will only return a table of buttons for the given controller" )] - public LuaTable Get(object controller = null) + public LuaTable Get(int? controller = null) { var buttons = _lua.NewTable(); foreach (var button in Global.ControllerOutput.Source.Type.BoolButtons) { - if (controller == null) + if (!controller.HasValue) { buttons[button] = Global.ControllerOutput[button]; } - else if (button.Length >= 3 && button.Substring(0, 2) == "P" + LuaInt(controller)) + else if (button.Length >= 3 && button.Substring(0, 2) == "P" + controller) { - buttons[button.Substring(3)] = Global.ControllerOutput["P" + LuaInt(controller) + " " + button.Substring(3)]; + buttons[button.Substring(3)] = Global.ControllerOutput["P" + controller + " " + button.Substring(3)]; } } @@ -39,9 +39,9 @@ namespace BizHawk.Client.Common { buttons[button] = Global.ControllerOutput.GetFloat(button); } - else if (button.Length >= 3 && button.Substring(0, 2) == "P" + LuaInt(controller)) + else if (button.Length >= 3 && button.Substring(0, 2) == "P" + controller) { - buttons[button.Substring(3)] = Global.ControllerOutput.GetFloat("P" + LuaInt(controller) + " " + button.Substring(3)); + buttons[button.Substring(3)] = Global.ControllerOutput.GetFloat("P" + controller + " " + button.Substring(3)); } }