[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  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] Refresh page


Posted by Merseberger   (4 posts)  [Biography] 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.
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] 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
[Go to top] top

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


9,325 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]