Jump to content




[Error] "=" expected at line 7


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

#1 Miros

  • New Members
  • 1 posts

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


#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

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.

#3 TheOddByte

    Lazy Coder

  • Members
  • 1,607 posts
  • LocationSweden

Posted 20 March 2013 - 08:10 AM

View PostLyqyd, on 20 March 2013 - 05:39 AM, said:

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






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users