Adding things to Corona objects

I was looking at a tutorial and I noticed that the author had done this sort of thing

local image = display.newImage(\<stuff\>) image:tap = function(e) \<stuff\> end image:addEventListener("tap",image) &nbsp;

i.e. he added new elements (in this case a table listener) to tables representing a Corona object.  Is this officially allowed, or a good idea ?

I can see the advantages of doing it but Corona Labs could introduce a ‘tap’ method themselves, which would break it (perhaps).

On the same lines, is there any sort of standard for adding other forms of data to Corona objects (which would be more efficient than wrapping them and exposing the methods !). The best solution I can see is to use an obscure sequence e.g.

image.\_\_Data\_\_ = {} image.\_\_Data\_\_.count = 0

so to minimise the chances of the identifier being used and if it is then it can be fixed using Search/Replace fairly easily.

Both methods are officially allowed, and “legal”.

http://docs.coronalabs.com/api/type/EventListener/addEventListener.html

Both methods are officially allowed, and “legal”.

http://docs.coronalabs.com/api/type/EventListener/addEventListener.html