Jump to content




If then bug?


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

#1 GyroW

  • Members
  • 11 posts

Posted 13 July 2013 - 05:06 AM

I'm trying to write a really simple program using the advanced computers and the miscperipherals chatbox.
Not working, really weird i'm using the if statement in it to check what the players says and if it says the right thing it will activate a door.
And i always get the error "bios:338 [string:jarvis]:3: 'then' expected.
Even if i make the most simple if program ever
if 1=1 then
print("ok")
end
I get the same darn error.
Is this a bug with the advanced computers
(Ps i'm using the ftb ultimate pack so CC and Miscperihperals from 1.4.7)
Any help would be handy.

#2 svdragster

  • Members
  • 222 posts
  • LocationGermany

Posted 13 July 2013 - 05:29 AM

local TestBoolean = true
if TestBoolean then -- Is the same as if TestBoolean == true
  print("Yay")
else
  print("Naw")
end


#3 Jan

  • Members
  • 141 posts
  • Locationthe Netherlands

Posted 13 July 2013 - 05:33 AM

In lua, when you compare two things, you should use == instead of =

if 1==1 then
print("ok")
end

setting variables is done with a single =

#4 svdragster

  • Members
  • 222 posts
  • LocationGermany

Posted 13 July 2013 - 05:38 AM

Isn't that in every language the same?

#5 GyroW

  • Members
  • 11 posts

Posted 13 July 2013 - 05:44 AM

Thanks jan, i forgot about that :(
Sorry to bother you guys

#6 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 13 July 2013 - 06:00 AM

View Postsvdragster, on 13 July 2013 - 05:38 AM, said:

Isn't that in every language the same?
Nope.

One example....... Pascal:
if someInt = 1 then
  result := true
else
  result := false






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users