touchpressed nil value

Issue #78 invalid
Former user created an issue

I get this error: attempt to call field 'touchpressed' (a nil value) when using love.touchpressed() on my nexus7 2 (WiFi) (32GB) and i dont know why. I hope this is the right place to ask this question, and please excuse any language mistakes.

Comments (2)

  1. Alex Szpakowski

    love.touchpressed is an event callback function you have to define (and LÖVE will call the function at the appropriate time), just like love.keypressed or love.mousepressed.

    Your code should look something like this:

    function love.load()
    
    end
    
    function love.touchpressed(id, x, y, pressure)
    
    end
    
    function love.update(dt)
    
    end
    
    function love.draw()
    
    end
    

    etc.

  2. Log in to comment