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

[Program] Replace

Started by m31317015, 29 March 2014 - 08:08 AM
m31317015 #1
Posted 29 March 2014 - 09:08 AM
I'm a coding noob and I go research a lot and I done my first programs.

Code:
function printUsage()
  print("Usage: replace <replace> <root>")
  return
end

local arg = {...}
local del = arg[1]
local copy = arg[2]

if #arg < 2 then
  printUsage()
  return
end

print("Replacing "..copy.." to "..del)
fs.delete(del)
fs.copy(copy,del)

4/6/2014

New Code:

function printUsage()
  print("Usage: replace <replace> <root>")
  return
end

local arg = {...}
local del = arg[1]
local copy = arg[2]

if #arg < 2 then
  printUsage()
  return
end

print("Replacing "..copy.." to "..del)
fs.delete(del)
fs.copy(copy,del)
Edited on 06 April 2014 - 01:00 AM
KillaVanilla #2
Posted 30 March 2014 - 02:56 AM
Just a heads up: Instead of using lists or formatted text for your code, put it in
 tags.

[CODE]
..so that it'll look like this.
Edited on 30 March 2014 - 12:57 AM
m31317015 #3
Posted 02 April 2014 - 04:40 PM
Thanks for reminding!