Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ Lua ➜ A simple if-then-else comparison produces errors

A simple if-then-else comparison produces errors

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Daniel P   USA  (97 posts)  Bio
Date Sat 17 Sep 2011 08:55 PM (UTC)
Message
Obviously I'm doing something wrong, though I can't tell what:


if GetVariable("rift_sugar") < GetVariable("rift_comm_max") or GetVariable("grecMax") ~= "ON" then
  ...Code that starts my awesome loop script.
else
  ColourNote("yellow","black","Rift is full and riftmax flag is on.")
end -- if

When I try to load the plugin, I receive the error:
Line 1887: Element name must start with letter or underscore, but starts with " " (Cannot load)


But when I changed the if-then-else to its contrapositive:

if GetVariable("rift_sugar") == GetVariable("rift_comm_max") and GetVariable("grecMax") == "ON" then
  ColourNote("yellow","black","Rift is full and riftmax flag is on.")
else
  ..Awesome loop code
end -- if


Can someone tell me what in the world I'm doing wrong in the first example? It looks fine to me...but I've run into this problem before.
Top

Posted by Bast   (78 posts)  Bio
Date Reply #1 on Sat 17 Sep 2011 09:15 PM (UTC)

Amended on Sat 17 Sep 2011 09:16 PM (UTC) by Bast

Message
Change the < to &lt;
You will also want to change > to &gt;

The < is being parsed as the beginning of an xml element.

You will only need to do this if the lua code is not in a CDATA section.

Bast

Bast

Scripts: http://github.com/endavis
Top

Posted by Daniel P   USA  (97 posts)  Bio
Date Reply #2 on Sat 17 Sep 2011 09:22 PM (UTC)
Message
Aha! Thank you so much...that does make sense.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


12,523 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.