there is a Box2D “match 3” flash game source here http://www.kongregate.com/forums/4-programming/topics/81112-match-3-type-game-with-box2d-trouble-with-the-match-3?page=2
you can convert that to Lua, since the same physics properties are available (maybe with slightly different names)
basically when an object touches you add it to a group (list) of all connected objects of the same type and store that list against each object. then when an object disconnects you break the list into 2 groups (the ones still connected to it and the ones not connected to it) and then store the list against the relevant objects again. by checking the length of this list you can check which are connected to at least 2 others, and do your match [import]uid: 6645 topic_id: 6336 reply_id: 22099[/import]