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

[Error] "=" expected at line 7

Started by Miros, 19 March 2013 - 11:52 PM
Miros #1
Posted 20 March 2013 - 12:52 AM
Greetings, This is my first time programming in lua, so I'm not familiar with how it works. I tried to make a turtle program to check when my processing facility is getting overloaded with stuff from a buildcraft quarry using ChickenBone's Wireless Redstone mod to cut the power. However, when i try to run it, i keep getting an error telling me that an "=" is expected at line 7. Here is the code i have used:

I have tried several different configurations at each of the If-Then-Else junctions, and have not been successful in getting it to run past line 7


while true do
  WR = peripheral.wrap("right")
	WR.setfreq(947)
  T = turtle.suckup(59)
  turtle.dropup()
  q = WR.get()
If T == true Then
  WR.set(true)
  print("Quarry overflow prevention Enabled")
  sleep(15)
  Elseif q == True Then
	  WR.set(False)
	  print("Quarry overflow prevention Disabled")
	Else
	  print("Quarry operating maintained")
	end
  end
end
Lyqyd #2
Posted 20 March 2013 - 05:39 AM
Split into new topic.

Lua is case-sensitive. "If" and "if" are different, and only one works. Hint: it's the second one.
TheOddByte #3
Posted 20 March 2013 - 08:10 AM
Split into new topic.

Lua is case-sensitive. "If" and "if" are different, and only one works. Hint: it's the second one.
Also 'Then' should be 'then'
More mistakes

Elseif = elseif
Else = else
True = true
False = false

turtle.dropup() = turtle.dropUp()

And as Lyqyd said
If = if

If you don't know the commands for turtle. to 100%
then type 'help turtle' in the CC computer

I hope you get the message I try to show you..
Also you put one to many end's

Here's the code that should work
Spoiler


while true do
  WR = peripheral.wrap("right")
		WR.setfreq(947)
  T = turtle.suckUp(59)
  turtle.dropUp()
  q = WR.get()
if T == true then
  WR.set(true)
  print("Quarry overflow prevention Enabled")
  sleep(15)
  elseif q == true then
		  WR.set(false)
		  print("Quarry overflow prevention Disabled")
		else
		  print("Quarry operating maintained")
		end
  end