Jump to content




What's wrong with this?


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

#1 Dlcruz129

    What's a Lua?

  • Members
  • 1,423 posts

Posted 22 November 2012 - 09:22 AM

http://pastebin.com/mq0eg2VP

The error is:
bios:388: [string "startup"]:21: 'then' expected

Line 21 is:

if output = true then

#2 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 22 November 2012 - 09:29 AM

The equal sign should be a double equal sign. Single equal signs are only used for setting variables. In ifs, you need to use the double equal sign.

if output == true then 


#3 Dlcruz129

    What's a Lua?

  • Members
  • 1,423 posts

Posted 22 November 2012 - 09:34 AM

View PostKingdaro, on 22 November 2012 - 09:29 AM, said:

The equal sign should be a double equal sign. Single equal signs are only used for setting variables. In ifs, you need to use the double equal sign.

if output == true then

Oh of course, instead of Lua saying "= expected", it had to give me a magical quest for finding my bug.

#4 ChunLing

  • Members
  • 2,027 posts

Posted 22 November 2012 - 09:40 AM

Lua thinks that you wanted to assign output = true, which would be perfectly valid usage. It was just letting you know that you didn't create a valid if then structure.

You can get away with "if output then ... end", and you probably should in a case like this if you normally have this kind of problem. The comparison operators should be reserved for when you actually need to do a comparison rather than check for whether something is already true.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users