fix error when using joystick button sources

This commit is contained in:
Andrew Minnich
2019-02-19 03:21:18 -05:00
parent ba11475dd4
commit b086f4cf19

View File

@@ -62,9 +62,11 @@ function sourceFunction.joystick.axis(joystick, value)
end end
function sourceFunction.joystick.button(joystick, button) function sourceFunction.joystick.button(joystick, button)
local isDown = tonumber(button) and joystick:isDown(tonumber(button)) if tonumber(button) then
or joystick:isGamepadDown(button) return joystick:isDown(tonumber(button)) and 1 or 0
return isDown and 1 or 0 else
return joystick:isGamepadDown(button) and 1 or 0
end
end end
function sourceFunction.joystick.hat(joystick, value) function sourceFunction.joystick.hat(joystick, value)