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, confirm your email, resolve issues, 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.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Lua ➜ Problem with newlines with AppendToNotepad

Problem with newlines with AppendToNotepad

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


Posted by Merseberger   (4 posts)  Bio
Date Sat 22 May 2010 06:47 AM (UTC)
Message
Hi all,

I am trying to use the Notepad functionality of LUA for the first time, and have run into an issue which I have not been able to figure out.

When I try to begin a newline with \r\n in my code, such as with

AppendToNotepad("Stats", "Here are some Stats\r\nHere are some more stats")

I get this error

Compile error
World: Aardwolf
Immediate execution
[string "Alias: "]:7: unfinished string near '"Here are some Stats'

If I remove the \r\n it works great, but I can't get a newline.

Is there something I'm missing to get this to work?

Thanks.
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #1 on Sat 22 May 2010 06:59 AM (UTC)
Message
I assume this is in the Send box of an alias, trigger, or other thing, not in a loose script. MUSHclient preprocesses that text, converting all escape sequences and replacing %1, %2 etc with the matched text, and @var1, @var2 etc with the associated MUSHclient variable contents. So you need your escape sequences to be able to survive that intact.

After being processed, \n becomes a newline. But what becomes \n after being processed? \\n does. So you should use \\r\\n instead, when your code is being evaluated in a Send box.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Merseberger   (4 posts)  Bio
Date Reply #2 on Sun 23 May 2010 06:12 AM (UTC)
Message
Thanks :)
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.


10,413 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.