I updated the script to version 1.1 and included something that’s very important, especially for those who use UI buttons in their apps:
Whether you are removing a group by calling group:removeSelf() or by using the cleanGroup() function, version 1.1 will first check to see if there are any touch listeners attached to the object and if so, will automatically remove them.
I tested the script on some ui buttons and it does in fact remove touch listeners before calling removeSelf() on the object.
Personally, I recommend creating a function that will remove all touch listeners, enterFrame events, etc. manually (and then call that before doing any kind of scene changes, etc.), BUT, if you use this cleangroup.lua, it’ll at least provide some added “security”, in case you forget to manually remove one of your touch listeners.
Note, I’m not really aware of any other way to attach a touch listener to an object, but in any case, the functions included in cleangroup.lua will only remove touch listeners that were defined in the following manner:
[blockcode]
myObject.touch = onObjectTouch
myObject:addEventListener( “touch”, myObject )
[/blockcode]
That’s probably how you’re already attaching your touch listeners (that’s also how ui.lua does it, in case you were wondering), and if you do it that way, the cleangroup.lua module will remove an attached touch listener before calling removeSelf() on the display object.
I hope this helps a lot of folks out, I know I’ll be using it in all of my projects moving forward 
Here’s a link to version 1.1 of the script: http://cl.ly/58zl [import]uid: 7849 topic_id: 7668 reply_id: 27418[/import]