Created
November 28, 2012 21:38
-
-
Save deanPGM/4164758 to your computer and use it in GitHub Desktop.
Twitter post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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