Thank you for any assistance,
pamiller3
local depth = ...
local depth = tonumber(...)
if depth == nil then
print 'Invalid depth'
return -- "this return statement stops the program right then and there."
end
-- "your digging code"
function dig()
local depth = tonumber(...)
if depth == nil then
print 'Invalid depth'
return
-- "this return statement works differently now"
-- "it just stops the function instead of the entire program"
end
-- "your digging code"
end
dig()
print 'Digging completed.' -- "so this text would still get printed, even if the user put an invalid number."
function dig(depth)
if depth == nil then
print 'Invalid depth'
return
end
-- "your digging code"
end
dig(tonumber(...))
--grab args to array
local tArgs = { ... }
--convert first argument to a number
local dist=tonumber(tArgs[1])
local argStr = table.concat( { ... }, " ")
do turtle.digdown()
do turtle.down()
local depth = ...
depth = tonumber(depth)
if depth == nil then
print 'INVALID'
return
end
turtle.digDown()
turtle.down()
local x, y, z = ...
In response to GopherAtl, it actually is possible to get multiple variables from … on one line, easily.
it's a minor point, perhaps, but using … without {} doesn't make it return everything, it just returns as if it were a comma-separated series.
for i=1,depth do
turtle.digDown()
turtle.down()
end