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

Test mining program error bios:328: [string "BetterThanMiner"]:34: expected "="

Started by Teraminer, 02 October 2012 - 05:05 PM
Teraminer #1
Posted 02 October 2012 - 07:05 PM
As the name suggests I get and error in line 34 in witch I am useing a function.

Thanks in advance!!!

Code: http://www.pastebin.com/Z4ycpEae
LucasUK #2
Posted 02 October 2012 - 07:12 PM
whats the error text?

try putting turtle.refuel( 4 )
Cranium #3
Posted 02 October 2012 - 07:16 PM
Error would be nice to know. Otherwise, we aren't sure what the problem is without running it. I can't do that, since I'm at work.
Doyle3694 #4
Posted 02 October 2012 - 08:03 PM
line 33 turtle.digdown needs () after it.
Cranium #5
Posted 02 October 2012 - 08:09 PM
You're right!
BrolofTheViking #6
Posted 02 October 2012 - 08:38 PM
Yep. For the future, that error is caused when the code thinks something is a variable, which happens to me most often when I misspell a function name, fail to capitalize a letter that needs to be, or, like in your case, don't include parenthesis on functions that need them.

It appears that Lua counts the parenthesis as part of the actual name of the function. In my experience, when the parenthesis are left out, many languages will still reference the function. However, in Lua, since the name of the function is turtle.digDown(), when you write turtle.digDown, it thinks that you are declaring a variable, thus it expects to have an =, and for a value to be assigned to the variable.

Just thought I would explain it so that you have an easier time identifying these errors in the future, since you will know where to look for them.
Lyqyd #7
Posted 02 October 2012 - 08:44 PM
Yep. For the future, that error is caused when the code thinks something is a variable, which happens to me most often when I misspell a function name, fail to capitalize a letter that needs to be, or, like in your case, don't include parenthesis on functions that need them.

It appears that Lua counts the parenthesis as part of the actual name of the function. In my experience, when the parenthesis are left out, many languages will still reference the function. However, in Lua, since the name of the function is turtle.digDown(), when you write turtle.digDown, it thinks that you are declaring a variable, thus it expects to have an =, and for a value to be assigned to the variable.

Just thought I would explain it so that you have an easier time identifying these errors in the future, since you will know where to look for them.

Functions are values. It thinks you'll be changing the value of the variable turtle.digDown. Appending the parentheses to a variable name simply attempts to call its contents. This is usually only done with variables containing functions (or more specifically, a reference to a function).
Teraminer #8
Posted 03 October 2012 - 03:52 PM
Thanks guys, I feel stupid :(/>/> (and the error is on the title.)
BrolofTheViking #9
Posted 04 October 2012 - 12:54 AM
Yep. For the future, that error is caused when the code thinks something is a variable, which happens to me most often when I misspell a function name, fail to capitalize a letter that needs to be, or, like in your case, don't include parenthesis on functions that need them.

It appears that Lua counts the parenthesis as part of the actual name of the function. In my experience, when the parenthesis are left out, many languages will still reference the function. However, in Lua, since the name of the function is turtle.digDown(), when you write turtle.digDown, it thinks that you are declaring a variable, thus it expects to have an =, and for a value to be assigned to the variable.

Just thought I would explain it so that you have an easier time identifying these errors in the future, since you will know where to look for them.

Functions are values. It thinks you'll be changing the value of the variable turtle.digDown. Appending the parentheses to a variable name simply attempts to call its contents. This is usually only done with variables containing functions (or more specifically, a reference to a function).
well… I was pretty close. What I said is what I thought was happening, based on a little over a week of programming in Lua, and very little programming experience in general.