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

[Lua] [Question] How may I get multiple files extracted from pastebin in a program?

Started by Persona, 03 June 2013 - 10:30 PM
Persona #1
Posted 04 June 2013 - 12:30 AM
Topic pretty much says it, what I am trying to accomplish:

A user types 'install' or hits a button and it executes a program that pastebin get's about 5 files.
I don't want to have to pastebin it every time my friend restarts the server, so I feel a command like this would be great.

Thanks for help.
Lyqyd #2
Posted 04 June 2013 - 01:51 AM
Why would you have to download the file every time your friend restarts the server?
GopherAtl #3
Posted 04 June 2013 - 08:52 AM
I'm guessing he means resets the world, not just restarts the server.

Two possibilities here. You can make one program that downloads all the other programs from pastebin automatically, or you can actually combine the programs together into a self-extracting package file of some sort. The latter is a bit tricky, but the first is quite easy though, and if you use a pastebin account rather than pasting annonymously, you will be able to update the files without their pastebin codes changing, so the installer will not have to change every time any of the other files change.

Example of the first:


--table of the program names and their pastebin codes to get
--(these codes are made up, no idea what, if anything, they would give you)
local programs = {
   program1="abcdefgh",
   program2="zyxwvuts",
   --can add as many more as you want
}

--loop over table, calling pastebin on each
for name,code in pairs(programs) do
  shell.run("pastebin", "get",code,name)
end
Persona #4
Posted 04 June 2013 - 07:44 PM
Well damn, that is exactly what I am looking for.
Also, I wanted to make it so I could do it with out my friend, and to cause him no trouble. :)/>