Function looping

I have a function that sends an email by displaying the native email popup, but when I return to my program, the popup is still there. Often, several iterations of the popup have been called. I have solved the problem with the following code:

[lua]

if emailEnabled == true then

    native.showPopup(“mail”, options)

    emailEnabled = false

end

[/lua]

However, I am confused as to why my function would be calling multiple times if I only tapped the button to call it once. 

Any explanations?

If you are using the touch event, understand that the listener is called at least two times (began/ended event)

If you are using the touch event, understand that the listener is called at least two times (began/ended event)