166 posts
Location
Don't look behind you..
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
64 posts
Posted 02 October 2012 - 07:12 PM
whats the error text?
try putting turtle.refuel( 4 )
3790 posts
Location
Lincoln, Nebraska
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.
818 posts
Posted 02 October 2012 - 08:03 PM
line 33 turtle.digdown needs () after it.
3790 posts
Location
Lincoln, Nebraska
Posted 02 October 2012 - 08:09 PM
You're right!
55 posts
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.
8543 posts
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).
166 posts
Location
Don't look behind you..
Posted 03 October 2012 - 03:52 PM
Thanks guys, I feel stupid :(/>/> (and the error is on the title.)
55 posts
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.