Just thought I'd tell you guys about by Twitter library for Lua.

https://github.com/TheLinx/ltwitter

It's pretty easy to use. You create a client instance, and start
calling the API functions.
Here's an example using the login methods:

require("twitter")
myclient = twitter.client("consumer key", "consumer secret")
authurl = myclient:startLogin()
-- get the user to open authurl, confirm access, and input the pin
into your application
-- we assume the pin variable is called "pin"
assert(myclient:confirmLogin(), "login failed")
myclient:updateStatus{ status = "Hello World! - From Lua!" }

As you can see, the API function methods use the actual Twitter API
variable names.
To check out what API functions correspond to the client methods, you
can use the following snippet:

require("twitter")
for method,api in pairs(twitter.resources) do
  print("client:"..method, api)
end

That'll print all methods and what API functions they use.
Now, what if you need to store your user's authorization key? This is
also easy.

tokenkey = cl.oauthclient.m_oauth_token
tokensecret = cl.oauthclient.m_oauth_token_secret
-- store these variables somewhere
-- now, next time you start:
require("twitter")
myclient = twitter.client("consumer key", "consumer secret", tokenkey,
tokensecret)
-- you're good to go!

I hope this library can be included in the official library list, and
I wish any Lua devs out there the best of luck.

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk

Reply via email to