Skip to content

Newlines and carriage returns insert junk characters when using echo in triggers after using deleteLine #7892

@jmckisson

Description

@jmckisson

Brief summary of issue:

I was trying to make a substitute trigger that would replace a line with a line rebuilt from a trigger pattern.
When using deleteLine() to get rid of the original line, then echo() to add the replacement, any carriage returns or line feeds in the echo are drawn as unprintable characters.

Steps to reproduce the issue:

  1. Make a trigger
  2. Use deleteLine() in the code
  3. Use echo containing a carriage return or line feed

Error output

Expected output from this example trigger is an echo with properly handled newlines.

Here is example output of what is happening when using deleteLine:
Image

And here is output with deleteLine() commented out:

Image

The intent of the trigger was to remove padding in the [ ]'s (as an example)

The trigger code is this:
regex pattern: [(\w+)\s+](.*)
lua code:
deleteLine()
echo("\n["..matches[2].."]"..matches[3])

Extra information, such as the Mudlet version, operating system and ideas for how to solve:

Mudlet 4.19.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions