isDown.lua 909 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. return {
  2. tag = 'input',
  3. summary = 'Get the state of a button on a device.',
  4. description = 'Returns whether a button on a device is pressed.',
  5. arguments = {
  6. device = {
  7. type = 'Device',
  8. description = 'The device.'
  9. },
  10. button = {
  11. type = 'DeviceButton',
  12. description = 'The button.'
  13. }
  14. },
  15. returns = {
  16. down = {
  17. type = 'boolean',
  18. description = [[
  19. Whether the button on the device is currently pressed, or `nil` if the device does not have
  20. the specified button.
  21. ]]
  22. }
  23. },
  24. variants = {
  25. {
  26. arguments = { 'device', 'button' },
  27. returns = { 'down' }
  28. }
  29. },
  30. notes = 'When hand tracking is active, pinching will be mapped to the `trigger` button.',
  31. related = {
  32. 'DeviceButton',
  33. 'lovr.headset.wasPressed',
  34. 'lovr.headset.wasReleased',
  35. 'lovr.headset.isTouched',
  36. 'lovr.headset.getAxis'
  37. }
  38. }