Multitouch and scaling

Hi there!

I’m new to lua and corona sdk, and I’m creating a pinch zoom library based on this tutorial:

https://coronalabs.com/blog/2013/01/22/implementing-pinch-zoom-rotate/

I was able to make it work, even made my own tweaks, but I’m stuck with making it a library, I wonder if you could help me in overcoming the error I have right now:

So what I did, is that in the multitouch.lua I added the following method:

function touchGroup:new(t)   touchGroup = t   touchGroup:addEventListener("touch")  -- listen for touches starting on the touch object   return t end

and I call it from my game.lua with:

-- include the multitouch local multitouch = require("multitouch") --some other code  multitouch:new(background)

where background is a rect.

I get the following error in multitouch.lua in the line where I set the listener:

addEventListener: listener cannot be nil: nil

I can post more code if needed, please share your thoughts, any helpd would be appreciated.  

You actually need to define the touch listener.  The error message is telling you there is no touch listener to call.  So something like this will fix it:

function touchGroup:touch(event) end touchGroup:addEventListener("touch") -- listen for touches starting on the touch object

You actually need to define the touch listener.  The error message is telling you there is no touch listener to call.  So something like this will fix it:

function touchGroup:touch(event) end touchGroup:addEventListener("touch") -- listen for touches starting on the touch object