Posted 10 August 2013 - 04:19 AM
Title: Using multiple arguments for a dig program
I want to use the same program to dig up, down and forward. It always gives me the error message that I put after the last else even though I type: dig forward 4
I want to use the same program to dig up, down and forward. It always gives me the error message that I put after the last else even though I type: dig forward 4
local args={...}
local arg1=args[1]
local arg2=args[2]
if arg1 == forward then
for i=1,tonumber(arg2) do
turtle.dig()
turtle.forward()
end
elseif arg1 == down then
for i=1,tonumber(arg2) do
turtle.digDown()
turtle.down()
end
elseif arg1 == up then
for i=1,tonumber(arg2) do
turtle.digUp()
turtle.up()
end
else
print("Usage: dig forward/up/down amountofblocks.")
end