Is it wise to put 2 touch functions on 1 object?

Good Day

Is it okay If I have 2 functions on 1 Object? I tried it and it worked, but the question is, is it wise? Will it consume more memory, or will it be the same? what are the risk if I do this? thanks in advance

code works like this:

local function A(event) --DO SOMETHING end local function B(event) --DO SOMETHING end local asd = display.newRect(0,0,100,100) asd.x = centerX asd.y = centerY asd:addEventListener("touch",A) asd:addEventListener("touch",B)

Hi @vonncc123,

You can do that, but I would ask, why would you need to? :slight_smile:

Brent

Occasionally I’ll add tap and touch listeners to one object (even that’s quite rare though), but I have to agree with Brent: why would you add 2 touch listeners?  

Just add one and have some conditions inside which make it do different things.

Hi @vonncc123,

You can do that, but I would ask, why would you need to? :slight_smile:

Brent

Occasionally I’ll add tap and touch listeners to one object (even that’s quite rare though), but I have to agree with Brent: why would you add 2 touch listeners?  

Just add one and have some conditions inside which make it do different things.