if chance1 == 1 then local function mini\_facebook2 ( self, event ) if event.phase == "began" then system.openURL( "WEBSITE 1" ) return true end end local function mini\_twitter2 ( self, event ) if event.phase == "began" then system.openURL( "WEBSITE 2" ) return true end end end if chance1 == 2 then local function mini\_facebook2 ( self, event ) if event.phase == "began" then system.openURL( "WEBSITE 3" ) return true end end local function mini\_twitter2 ( self, event ) if event.phase == "began" then system.openURL( "WEBSITE 4" ) return true end end end function scene:createScene( event ) local screenGroup = self.view chance1 = math.random (1,2) print(chance1) mini\_facebook = display.newImage("levelfailed\_mini\_facebook.png") mini\_facebook.x = display.contentWidth /10 mini\_facebook.y = display.contentHeight / 1.3 screenGroup:insert( mini\_facebook ) mini\_facebook.touch = mini\_facebook2 mini\_facebook:addEventListener( "touch", mini\_facebook ) mini\_twitter = display.newImage("levelfailed\_mini\_twitter.png") mini\_twitter.x = display.contentWidth /4.45 mini\_twitter.y = display.contentHeight / 1.3 screenGroup:insert( mini\_twitter ) mini\_twitter.touch = mini\_twitter2 mini\_twitter:addEventListener( "touch", mini\_twitter ) end
When I press the Facebook or Twiiter button, nothing happens; only works if i remove a
if chance1 == X then
but then i have only one case. How can I randomly acces a function?
Thank you!