.temp:10: <name> expected near '0'

Started by TheTinyDeskEngineer, Mar 25, 2021, 02:35 PM

Previous topic - Next topic

TheTinyDeskEngineer

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

TheTinyDeskEngineer

Blowing the blocks up with TNT will work for now

Lupus590

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