Hamburger Menu

Hi there, I’m pretty new to using Lua and am building an app. So I’m currently working on a hamburger menu for my app. So far I have the side menu sliding back and forth when I click on the hamburger itself. However I’m now looking to activate the side menu when the user touches outside the side menu if that makes sense.

What I have so far attached to an EventListener is the following: 

 local function toggleSideMenu()

  if sideShow == false then 

     

     transition.to( sideMenuBG, { time=1000, x=-300, transition=easing.outExpo});

     transition.to( sidemenuoption1, { time=1400, y=80, x=-80, transition=easing.outExpo});

     transition.to( sidemenuoption2 { time=1500, y=120, x=-100, transition=    easing.outExpo});

     transition.to( hamburgerbutton, { time=2100, y=42, x=26, transition=easing.outExpo});

     

     sideShow = true;

  else

  

   transition.to( sideMenuBG, { time=1000, x=100, transition=easing.outExpo});

   transition.to( sidemenuoption1, { time=1600, y=80, x=60, transition=easing.outExpo});

   transition.to( sidemenuoption2, { time=1500, y=120, x=60, transition=easing.outExpo});

   transition.to( hamburgerbutton, { time=2100, y=42, x=230, transition=easing.outExpo});

   

    sideShow = false;

  end

end

Anybody any ideas? 

Thanks!