Posting on Twitter Problem

I have a problem with my Twitter posting code. Whenever I click on the twitter button, it says Bad argument in #1 gsub (String Expected, got table). Could anyone help me fix this problem?

[lua]local tweet = display.newImage(“tweet.png”)
tweet.x = 80; tweet.y = 271
tweet.xScale = .435; tweet.yScale = .435
localGroup:insert(tweet)

local function escape(s)
s = string.gsub(s, “([&=+%c])”, function ©
return string.format("%%%02X", string.byte©)
end)
s = string.gsub(s, " ", “+”)
return s
end
tweetText = “I love Gun App for Nook! Check it out http://bit.ly/A8NmI6 #gunapp #ninjapigstudios
local postBody = escape( tweetText )
local theNetwork = theNetwork or “twitter” – twitter is default

–local theString = string.gsub(message, “( )”, “%%20”)

TwitterButtonRelease = function(event)
if theNetwork == theNetwork or “twitter” then
system.openURL(“http://twitter.com/intent/tweet?text=”…postBody)
end
end[/lua]

Regards,
Jordan Schuetz
Ninja Pig Studios [import]uid: 29181 topic_id: 21185 reply_id: 321185[/import]