Difference between revisions of "Joystick:getDeviceInfo"

(Created page with "{{newin|11.3|113|type=function}} Gets the USB vendor ID, product ID, and product version numbers of joystick which consistent across operating systems. Can be used to sho...")
 
m (Remove strong notice about SDL 2.0.6)
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
  
 
Can be used to show different icons, etc. for different gamepads.
 
Can be used to show different icons, etc. for different gamepads.
{{notice|This function returns 0 for all the values if LÖVE is compiled with SDL 2.0.5 or earlier.}}
 
 
== Function ==
 
== Function ==
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
vendorID, productID, productVersion = Joystick:getDeviceInfo()
+
vendorID, productID, productVersion = Joystick:getDeviceInfo( )
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===

Latest revision as of 03:20, 21 December 2022

Available since LÖVE 11.3
This function is not supported in earlier versions.

Gets the USB vendor ID, product ID, and product version numbers of joystick which consistent across operating systems.

Can be used to show different icons, etc. for different gamepads.

Function

Synopsis

vendorID, productID, productVersion = Joystick:getDeviceInfo( )

Arguments

None.

Returns

number vendorID
The USB vendor ID of the joystick.
number productID
The USB product ID of the joystick.
number productVersion
The product version of the joystick.

Notes

Some Linux distribution may not ship with SDL 2.0.6 or later, in which case this function will returns 0 for all the three values.

See Also

Other Languages