Jump to content




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


  • You cannot reply to this topic
8 replies to this topic

#1 Teraminer

  • New Members
  • 175 posts
  • LocationDon't look behind you..

Posted 02 October 2012 - 06: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

#2 LucasUK

  • Members
  • 64 posts

Posted 02 October 2012 - 06:12 PM

whats the error text?

try putting turtle.refuel( 4 )

#3 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 02 October 2012 - 06: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.

#4 Doyle3694

  • Members
  • 815 posts

Posted 02 October 2012 - 07:03 PM

line 33 turtle.digdown needs () after it.

#5 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 02 October 2012 - 07:09 PM

You're right!

#6 BrolofTheViking

  • Members
  • 55 posts

Posted 02 October 2012 - 07: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.

#7 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 02 October 2012 - 07:44 PM

View PostBrolofTheViking, on 02 October 2012 - 07:38 PM, said:

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).

#8 Teraminer

  • New Members
  • 175 posts
  • LocationDon't look behind you..

Posted 03 October 2012 - 02:52 PM

Thanks guys, I feel stupid :(/> (and the error is on the title.)

#9 BrolofTheViking

  • Members
  • 55 posts

Posted 03 October 2012 - 11:54 PM

View PostLyqyd, on 02 October 2012 - 07:44 PM, said:

View PostBrolofTheViking, on 02 October 2012 - 07:38 PM, said:

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.





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users