This is my first project using http.request and openURL. Can anyone show me a tutorial that uses Parameter tables for http.request?
-- HTTP.REQUEST
-- Use this function to perform your initial setup
function setup()
TwitterLogo = nil
end
-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50)
font("AmericanTypewriter-Condensed")
fill(237, 237, 237, 255)
text("Double-Tap to load",WIDTH/2,HEIGHT/2)
if TwitterLogo ~= nil then
sprite(TwitterLogo,WIDTH/2,HEIGHT/2,WIDTH,HEIGHT)
openURL("http://www.twitter.com")
end
--Do your drawing here
end
function didGetLogo(theImage,status,head)
TwitterLogo = theImage
print("Status: "..status)
if status < 200 then
print("Error")
print("Error report: "..status)
print("This is a "..status.." error")
print("--------------------")
else
if status > 201 then
print("Error")
print("Error Report: "..status)
print("This is a "..status.." error")
print("-------------------")
end
if status == 404 then
print("Please check your WiFi connection")
print("or check to see you have a valid link")
end
end
end
function touched(t)
if t.tapCount == 1 and t.state == ENDED then
http.request("http://images.wikia.com/moshimonsters/images/a/a7/Twitter_Logo.jpg",didGetLogo)
end
if status == 200 then
openURL("http://twitter.com")
end
end