This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
PSanf420's profile picture

[Code Review/Request for Comments] Pastebin Lua Object to allow easier integration of Pastebin functionality

Started by PSanf420, 16 May 2013 - 10:26 AM
PSanf420 #1
Posted 16 May 2013 - 12:26 PM
This is a reqest for comments on a little program I wrote. It doesn't do anything majorly fancy. It just allows you to log into Pastebin, create a paste, and download a paste. I did it using OOP techniques to allow it to be more easily used from with a Lua program in CraftOS. I plan on expanding the functionality, but for now it's just a proof of concept thing.

http://pastebin.com/kCLbg74w
http://pastebin.com/LcmvcLcU

I plan on updating this to allow the programmer to lists pastes created by a user, but that will require some more intensive string manipulation to package the output into a table for easier usage. Perhaps I should just return the whole string and let the calling script handle it? Thanks :)/> Also, does anyone know if it's possible to edit a preexisting paste on Pastebin through their API? I haven't seen any information documented, but would love to include the functionality if it's available.

Here's where I'm getting the Lua OOP information from: http://www.computerc...ua/page__st__40

EDIT: I've updated the code to include greater functionality. The new version is at http://pastebin.com/vCsXa43r
The code can now get a list of a users posts, turn the raw XML into a table, download a paste into a file, and create a paste from a file.
Lyqyd #2
Posted 16 July 2013 - 01:31 PM
This sounds intriguing, but does not seem like it really belongs in Ask a Pro. I'll move this to General for greater visibility.