Difference between revisions of "love.joystick.getJoysticks"

m (Improved example a bit)
m
Line 18: Line 18:
 
function love.draw()
 
function love.draw()
 
     for i, joystick in ipairs(joysticks) do
 
     for i, joystick in ipairs(joysticks) do
         love.graphics.print(joystick:getName(), 10, i * 18)
+
         love.graphics.print(joystick:getName(), 10, i * 20)
 
     end
 
     end
 
end
 
end

Revision as of 04:47, 29 August 2013

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

Gets a list of connected Joysticks.

Function

Synopsis

joysticks = love.joystick.getJoysticks( )

Arguments

None.

Returns

table joysticks
The list of currently connected Joysticks.

Examples

function love.load()
    joysticks = love.joystick.getJoysticks()
end

function love.draw()
    for i, joystick in ipairs(joysticks) do
        love.graphics.print(joystick:getName(), 10, i * 20)
    end
end

See Also

Other Languages