Jump to content




Automatically download Pastebin programs

computer command lua

4 replies to this topic

#1 Barlender

  • Members
  • 15 posts

Posted 09 July 2015 - 07:19 AM

Ok, so I am trying to create a program which uses pastebin links to download other programs onto the computer. I've seen this method done with other programs, I just never actually saw the command to do so.

The command which I attempted to use was:

if fs.exists("<program name>") ~= then
shell.run("pastebin get <pastebin code> <program name>")
end

The error I got when I ran this program was "bios:339: [string "startup"]:1: unexpected symbol". I assume the unexpected symbol refers to the "~", but I am not sure. Any help would be much appreciated.




#2 Square789

  • Members
  • 39 posts
  • LocationUniverse:C:/MilkyWay/Sol/Earth/Europe/Germany

Posted 09 July 2015 - 02:24 PM

Very simple, you just compared the returned value with...nothing
The compiler expected the end of the statement with the brackets, but then you just put an operator there.
I'd use
if not fs.exists(filename) then
Also, don't use a string in the fs.exists()-function ("<program name>") but a variable.
Same with <pastebin code>, replace this with
shell.run("pastebin get "..pastecode.." "..filename)

Edited by Square789, 09 July 2015 - 02:27 PM.


#3 meigrafd

  • Members
  • 17 posts
  • LocationGermany

Posted 09 July 2015 - 02:49 PM

Have a look on this: https://github.com/s...r/bootstrap.lua

#4 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 09 July 2015 - 03:28 PM

View Postmeigrafd, on 09 July 2015 - 02:49 PM, said:


That really isn't relevant to the error in question. It's his file that's causing problems.

#5 Barlender

  • Members
  • 15 posts

Posted 10 July 2015 - 05:19 AM

View PostSquare789, on 09 July 2015 - 02:24 PM, said:

Very simple, you just compared the returned value with...nothing
The compiler expected the end of the statement with the brackets, but then you just put an operator there.
I'd use
if not fs.exists(filename) then
Also, don't use a string in the fs.exists()-function ("<program name>") but a variable.
Same with <pastebin code>, replace this with
shell.run("pastebin get "..pastecode.." "..filename)

I tried your suggestion, and it worked! Also thank's for suggesting that I use a variable rather than a string, that was another issue I was having :P Thanks for the help





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users