TheKojent icon

rowExcavate

TheKojent | PRO | 04/06/13 09:22:11 PM UTC | 0 ⭐ | 205 👁️ | Never ⏰ | []
Lua |

420 B

|

None

|

0 👍

/

0 👎

local tArgs = { ... }
local depth = 0
 
if #tArgs ~= 1 then
    print("Usage: rowExcavate <length>")
    return
end
 
length = tonumber(tArgs[1])
os.loadAPI("try")
 
for i = 1,length do
    while try.down() do
        depth = depth + 1
    end
    while depth ~= 0 do
        try.up()
        depth = depth - 1
    end
    if i ~= length then
        if not try.forward() then
            print("Cannot move forward! Exiting script!")
            return
        end
    end
end

Comments