Jump to content




fs.copy([["disk/]]..input..[[", "startup") Does not work?


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

#1 SNWLeader

  • Members
  • 71 posts
  • LocationTampa Bay, Florida

Posted 20 January 2013 - 01:51 PM

I am trying to make a part in my system that will update when you get past a password protection and after that will copy the program file on a floppy and replace the one currently running, but i cannot get passed the error of startup:185: expected string, string

I understand what the startup:185: is I am giving the segment of the code that I am trying to get happen.

I need it to take the input given by the user and put it in this.

fs.copy("disk/[Userinput Here!]", "startup")

I tried doing it this way.
fs.copy([["disk/]]..input..[[", "startup]])

that does not work with this one.

#2 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 20 January 2013 - 01:53 PM

fs.copy( "disk/"..input, "startup" )

you had a few misplaced " in the first one

and the second one... well.... [[ ]] dont work in that way...

Edited by TheOriginalBIT, 20 January 2013 - 01:53 PM.


#3 SNWLeader

  • Members
  • 71 posts
  • LocationTampa Bay, Florida

Posted 20 January 2013 - 02:25 PM

Yep that worked just nicely. Thanks. :D

#4 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 20 January 2013 - 02:32 PM

View PostSNWLeader, on 20 January 2013 - 02:25 PM, said:

Yep that worked just nicely. Thanks. :D
No problems :)

Just as a note:
common usage of [[ ]] is to have a string formatted exactly as it is provided... for example
local handle = fs.open( filePath, "w" )
handle.write([[
This would write the following
text into the file exactly
how it appears here.

Optionally some other data can be added
by doing this ]]..someData..[[

That is all :)/>
]])
handle.close()






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users