This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
blairjam's profile picture

Error in Function Declaration [Solved]

Started by blairjam, 17 December 2012 - 03:31 PM
blairjam #1
Posted 17 December 2012 - 04:31 PM
I am new to Lua, and as having a background in C++ and Java, some things are a little confusing. That being said, I do make stupid mistakes sometimes and just don't see them… ;)/>

Ok, I am making a mining program and I am getting this error:

> mine 5
bios:338:  [string "mine"]:18: '=' expected

Now, I'm not sure what on line 18 should be set equal to anything.

local args = {...}
local length = tonumber(args[1])

function digAbove()
  while turtle.detectUp() == true do
	turtle.digUp()
	sleep(0.5)
  end
end

function digForward()
  while turtle.detect() == true do
	turtle.dig()
	sleep(0.5)
  end
end

funtion mine(dist) <-------- Line 18
  digAbove()
  for i = 1, dist do
	digForward()
	turtle.forward()
	digAbove()
  end
end

mine(length)


So, what is wrong here? I've tried making dist equal to something, but that doesn't change it either… And I'm not calling anything before it's defined, so I'm really at a loss.
etopsirhc #2
Posted 17 December 2012 - 04:36 PM
take a close look at the syntax highlighting on the forum , you miss spelled function
blairjam #3
Posted 17 December 2012 - 04:38 PM
See, I said it would be something stupid…

Thanks though!