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

[LUA][Error][Question] Misc. Errors and Questions :P

Started by rhyser9, 29 December 2012 - 10:57 AM
rhyser9 #1
Posted 29 December 2012 - 11:57 AM
Hey, I'm just delving into the mysteries of ComputerCraft and decided to make a tree farm as my first project. I just finished writing my code, but came across an error saying it was expecting an = sign, but looking at the code, no = sign belongs on that line as far as I can tell. http://pastebin.com/um7B9xTX
Error:

bios:388: [string "TreeFarm"]:76: '=' expected
EDIT: Fixed, Thanks OmegaVest! Here's the new code: http://pastebin.com/pTdEYhGU Please tell me about anything else I should be doing!


How can I check multiple parameters in a while loop? a.k.a

while condition1 = true & quantity1 > 50 do
  stuff
end
EDIT: Fixed, Thanks Diegodan1983!

BTW, if you see anything I should be doing differently, tell me! I'm just learning lua, and would love some tips!
OmegaVest #2
Posted 29 December 2012 - 12:02 PM
You forgot the parentheses on the line previous.


Actually, you forgot parentheses for a lot of functions. Just because they have no parameters does not mean they don't need parentheses. Yay multi-negatives.
rhyser9 #3
Posted 29 December 2012 - 12:08 PM
You forgot the parentheses on the line previous.

Actually, you forgot parentheses for a lot of functions. Just because they have no parameters does not mean they don't need parentheses. Yay multi-negatives.
Oops duh. I wasn't paying attention and forgot that they all require parantheses. Thx.
diegodan1893 #4
Posted 30 December 2012 - 12:33 AM
to check multiple paramethers you must do:

while condition1 == true and quantity1 > 50 do
  stuff
end
--also you can do
while condition1 == true or quantity1 > 50 do
  stuff
end
rhyser9 #5
Posted 30 December 2012 - 08:33 AM
to check multiple paramethers you must do:

while condition1 == true and quantity1 > 50 do
  stuff
end
--also you can do
while condition1 == true or quantity1 > 50 do
  stuff
end
Thanks diego, I didn't think of using the word 'and' instead of '&' :P/>