Skip to content

Instantly share code, notes, and snippets.

@deanPGM
Created November 28, 2012 21:38
Show Gist options
  • Save deanPGM/4164758 to your computer and use it in GitHub Desktop.
Save deanPGM/4164758 to your computer and use it in GitHub Desktop.
Twitter post
-- Requires GGTwitter libs to be setup
-- https://github.com/GlitchGames/GGTwitter
tweeted = false
local listenerTwitter = function( event )
if event.phase == "authorised" and tweeted == false then
print "twitter authorised"
twitter:post( "Test Tweet 1 of 2" )
native.showAlert("Twitter", "Your score has been posted to Twitter!", {"Ok"})
end
end
local function postTwitter (event)
if twitter:isAuthorised() == true then
print "POSTING TO TWITTER"
tweeted = true
twitter:post( "Test Tweet 2 of 2" )
native.showAlert("Twitter", "Your score has been posted to Twitter!", {"Ok"})
else
print "AUTHING WITH TWITTER"
twitter:authorise()
end
end
-- Use this to call the postTwitter function
twitterBtn:addEventListener("tap", postTwitter)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment