getAxis.lua 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. return {
  2. tag = 'input',
  3. summary = 'Get the state of an analog axis on a device.',
  4. description = [[
  5. Get the current state of an analog axis on a device. Some axes are multidimensional, for
  6. example a 2D touchpad or thumbstick with x/y axes. For multidimensional axes, this function
  7. will return multiple values, one number for each axis. In these cases, it can be useful to use
  8. the `select` function built in to Lua to select a particular axis component.
  9. ]],
  10. arguments = {
  11. {
  12. name = 'device',
  13. type = 'Device',
  14. description = 'The device.'
  15. },
  16. {
  17. name = 'axis',
  18. type = 'DeviceAxis',
  19. description = 'The axis.'
  20. }
  21. },
  22. returns = {
  23. {
  24. name = '...',
  25. type = 'number',
  26. description = [[
  27. The current state of the components of the axis, or `nil` if the device does not have any
  28. information about the axis.
  29. ]]
  30. }
  31. },
  32. notes = [[
  33. The axis values will be between 0 and 1 for 1D axes, and between -1 and 1 for each component of
  34. a multidimensional axis.
  35. ]],
  36. related = {
  37. 'DeviceAxis',
  38. 'lovr.headset.isDown'
  39. }
  40. }