Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- ---------------+
- Documentation--|
- ---------------+
- Load(pastebin code) | performs a loadstring()
- on the pastebin code you insert.
- ----|
- ----|
- DLoad(code, path) | Downloads the pastebin code
- you supply to the path you supply
- ----|
- ----|
- ULoad(path) | Uploads the file you specify to
- pastebin
- Returns the pastebin code.
- --]]
- local function getString(pastebin)
- A = http.get("http://pastebin.com/raw/"..pastebin)
- return A.readAll()
- end
- function Load(pastebin)
- loadstring(getString(pastebin))()
- return true
- end
- function DLoad(pastebin,path)
- local A = getString(pastebin)
- local file = fs.open(path,"w")
- file.write(A)
- file.flush()
- file.close()
- return true
- end
- function ULoad(file)
- local f = fs.open(file,"r")
- local uF = f.readAll()
- f.close()
- local name = fs.getName(file)
- local key = "0ec2eb25b6166c0c27a394ae118ad829"
- local response = http.post(
- "http://pastebin.com/api/api_post.php",
- "api_option=paste&"..
- "api_dev_key="..key.."&"..
- "api_paste_format=lua&"..
- "api_paste_name="..textutils.urlEncode(name).."&"..
- "api_paste_code="..textutils.urlEncode(uF)
- )
- local sResponse = response.readAll()
- response.close()
- local CODE = string.match( sResponse, "[^/]+$" )
- return CODE
- end
Add Comment
Please, Sign In to add comment