Jump to content




PLoad | A way to use pastebin in your code


  • You cannot reply to this topic
8 replies to this topic

#1 CLNinja

  • Members
  • 191 posts

Posted 24 February 2017 - 01:03 AM

PLoad

Ever needed to download or upload a file, or even just pastebin run code from your programs?

Well, now you can do so very easily! With, PLoad!

PLoad contains 3 functions:


Load: Pastebin run function


DLoad: Pastebin get function


ULoad: Pastebin put function


All documentation for the functions can be found in the top of the file on pastebin.



pastebin get KHPwnyHG



#2 fishermedders

  • Members
  • 31 posts
  • LocationDiscord fishermedders#8254

Posted 24 February 2017 - 11:36 PM

This seems clever but it would probably not be as useful as you'd think; iirc, pastebin will blacklist a server (or your computer if on emulator)'s IP if you make too many calls.

Imo it would just be easier to make a general-use api to include your functions in.

#3 CLNinja

  • Members
  • 191 posts

Posted 26 February 2017 - 05:00 PM

View Postfishermedders, on 24 February 2017 - 11:36 PM, said:

This seems clever but it would probably not be as useful as you'd think; iirc, pastebin will blacklist a server (or your computer if on emulator)'s IP if you make too many calls.

Imo it would just be easier to make a general-use api to include your functions in.

Yes but you could do the same thing without an API :P

shell.run("pastebin get code test")

you can spam that and achieve the same blacklist. The blacklist is a 24 hr blacklist though, so its not permanent.

Also what do you mean about the general-use api?

#4 fishermedders

  • Members
  • 31 posts
  • LocationDiscord fishermedders#8254

Posted 26 February 2017 - 07:16 PM

View PostCLNinja, on 26 February 2017 - 05:00 PM, said:

Also what do you mean about the general-use api?

Just like if you're gonna have a bunch of functions to use in a program, why not create an API that you can use over and over again (or just for this 1 program), that has all of the functions that you need in it, and download it once rather than spamming pastebin for it. Just my opinion.

Edited by fishermedders, 26 February 2017 - 07:17 PM.


#5 CLNinja

  • Members
  • 191 posts

Posted 26 February 2017 - 08:53 PM

View Postfishermedders, on 26 February 2017 - 07:16 PM, said:

View PostCLNinja, on 26 February 2017 - 05:00 PM, said:

Also what do you mean about the general-use api?

Just like if you're gonna have a bunch of functions to use in a program, why not create an API that you can use over and over again (or just for this 1 program), that has all of the functions that you need in it, and download it once rather than spamming pastebin for it. Just my opinion.
I have no idea what you're talking about.

#6 fishermedders

  • Members
  • 31 posts
  • LocationDiscord fishermedders#8254

Posted 27 February 2017 - 02:24 AM

View PostCLNinja, on 26 February 2017 - 08:53 PM, said:

View Postfishermedders, on 26 February 2017 - 07:16 PM, said:

View PostCLNinja, on 26 February 2017 - 05:00 PM, said:

Also what do you mean about the general-use api?

Just like if you're gonna have a bunch of functions to use in a program, why not create an API that you can use over and over again (or just for this 1 program), that has all of the functions that you need in it, and download it once rather than spamming pastebin for it. Just my opinion.
I have no idea what you're talking about.
Basically, if you wanted to have all of your functions in a file, you'd do something like this:

myapi:
function centerPrint( sText, nY ) -- The text to center, the Y Line.
  tSize = { term.getSize() }
  term.setCursorPos( math.floor( tSize[1]/2 )-math.floor( #sText/2 ), nY )
  term.write( sText )
end

function sayHello()
  print( "Hello, world!" )
end

function foo()
  return "bar"
end

Then in another file, you would be able to do things like:
programusingapi:
bDidLoad= os.loadAPI("myapi")
if bDidLoad then
  myapicenterPrint( "Hello World!", 1 )

  myapi.sayHello()

  print( myapi.foo() )
end

I usually make APIs like this for functions that I use most often.
[Edit Reason: Wacky code formatting]

Edited by fishermedders, 27 February 2017 - 02:25 AM.


#7 CLNinja

  • Members
  • 191 posts

Posted 27 February 2017 - 04:04 AM

View Postfishermedders, on 27 February 2017 - 02:24 AM, said:

View PostCLNinja, on 26 February 2017 - 08:53 PM, said:

View Postfishermedders, on 26 February 2017 - 07:16 PM, said:

View PostCLNinja, on 26 February 2017 - 05:00 PM, said:

Also what do you mean about the general-use api?

Just like if you're gonna have a bunch of functions to use in a program, why not create an API that you can use over and over again (or just for this 1 program), that has all of the functions that you need in it, and download it once rather than spamming pastebin for it. Just my opinion.
I have no idea what you're talking about.
Basically, if you wanted to have all of your functions in a file, you'd do something like this:

myapi:
function centerPrint( sText, nY ) -- The text to center, the Y Line.
  tSize = { term.getSize() }
  term.setCursorPos( math.floor( tSize[1]/2 )-math.floor( #sText/2 ), nY )
  term.write( sText )
end

function sayHello()
  print( "Hello, world!" )
end

function foo()
  return "bar"
end

Then in another file, you would be able to do things like:
programusingapi:
bDidLoad= os.loadAPI("myapi")
if bDidLoad then
  myapicenterPrint( "Hello World!", 1 )

  myapi.sayHello()

  print( myapi.foo() )
end

I usually make APIs like this for functions that I use most often.
[Edit Reason: Wacky code formatting]

.......

THIS IS AN API YOU NITWIT, YOU JUST EXPLAINED HOW TO USE THIS API.

#8 fishermedders

  • Members
  • 31 posts
  • LocationDiscord fishermedders#8254

Posted 27 February 2017 - 04:22 AM

View PostCLNinja, on 27 February 2017 - 04:04 AM, said:


.......

THIS IS AN API YOU NITWIT, YOU JUST EXPLAINED HOW TO USE THIS API.

lmao chill hombre, I'm just saying that instead of downloading the file every time and loadstring'ing it every time, it'd just be easier to download it once and maybe even check for newer versions. The whole point of my posts is my suggestion of that of the pastebin blacklist

#9 CLNinja

  • Members
  • 191 posts

Posted 28 February 2017 - 01:08 AM

View Postfishermedders, on 27 February 2017 - 04:22 AM, said:

View PostCLNinja, on 27 February 2017 - 04:04 AM, said:

.......

THIS IS AN API YOU NITWIT, YOU JUST EXPLAINED HOW TO USE THIS API.

lmao chill hombre, I'm just saying that instead of downloading the file every time and loadstring'ing it every time, it'd just be easier to download it once and maybe even check for newer versions. The whole point of my posts is my suggestion of that of the pastebin blacklist

This is literally an implementation of pastebin but instead of a program with arguments, its all function calls.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users