|
Many thanks. I've been replacing filter scripts on my Diplomacy game server with Lua. My CRM-114 Twitter client code quit when OAuth became mandatory, so this is perfect timing.
Signoff
Chris
My waffle iron beat up your smart phone.
On Sep 24, 2010 2:09 AM, "Linus Sjögren" <thelinx@unreliablepollution.net> wrote:
Hello!
Thanks to ignacio's OAuth library, ltwitter now has support for full
support for Twitter authentication and the likes.
That means you can do groovy Twitter stuff from Lua without learning
the dark magics yourself!
The rockspec is already in the Luarocks repository, so to get started,
just install the "twitter" package and get going!
Hints:
You do everything with a "client". To get yourself a client, call "cl
= twitter.client("oauth consumer key", "oauth consumer secret")".
The API uses the same argument names as the Twitter API. No exceptions.
Therefore, the best documentation for this module are these two links:
- Twitter API docs: http://dev.twitter.com/doc
- List of client methods:
http://github.com/TheLinx/ltwitter/blob/master/twitter/init.lua#L13
Example:
" showList = {"GET", ":user/lists/:id"},"
Here's the information we get by this function:
1. The function is called "showList", so you call myClient:showList
2. If you want info about the API resource, go to
http://dev.twitter.com/doc/get/:user/lists/:id
3. Two required arguments are "user" and "id" (:user, :id)
So, an example would be this:
list = myClient:showList{user = "twitter", id = "team"}
To authenticate, the process is not _that_ tricky.
url = "">
Tell your user to go to "url" and confirm access. They will see a PIN
code that they put into the application. The application does this:
myClient:confirmLogin("*pin code*")
And you're set to go!
Good luck everyone! Let's see some Lua-based Twitter clients!
Links:
(you can download with luarocks, "luarocks install twitter")
http://github.com/TheLinx/ltwitter/
http://github.com/ignacio/LuaOAuth/