ComputerCraft Forums

ComputerCraft => Ask a Pro => Topic started by: TheTinyDeskEngineer on Mar 25, 2021, 02:35 PM

Title: .temp:10: <name> expected near '0'
Post by: TheTinyDeskEngineer on Mar 25, 2021, 02:35 PM
I'm working on a turtle program to dig up blocks because I need a lot of them and it's annoying to mine it
local tArgs = { ... }
if #tArgs < 3 then
    error("Usage: quarry <x> <y> <z>")
end
local width = tonumber(tArgs[1])
local height = tonumber(tArgs[2])
local depth = tonumber(tArgs[3])
if turtle.getFuelLevel() < 100 then
    turtle.refuel()
end
for 0, height do
    turtle.digDown()
    turtle.down()
    for 0, depth do
      for 0, width do
        if turtle.getFuelLevel() < 100 then
            turtle.refuel()
        end
        turtle.dig()
        turtle.forward()
      end
      turtle.turnRight()
      turtle.dig()
      turtle.forward()
      turtle.turnRight()
    end
end
Title: .temp:10: <name> expected near '0'
Post by: TheTinyDeskEngineer on Mar 25, 2021, 02:44 PM
Blowing the blocks up with TNT will work for now
Title: .temp:10: <name> expected near '0'
Post by: Lupus590 on Mar 25, 2021, 11:07 PM
for 0, height do is not valid lua, you need a variable to store the values between 0 and height in. You'll have the same issue with your depth and width loops

try for h = 0, height do