.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
Code Select
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

Code Select
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
Code Select
for h = 0, height do