Skip to content
View in the app

A better way to browse. Learn more.

WRobot

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

C# Variable in Lua.DoString() gives lua error

Featured Replies

 

Hi.

Working on a project to send invitation letters and faced the problem.  I don’t understand what kind of garbage happens when I try to send an mail using the line break character "/"  in the message.

 

I just want to send a message with separated lines, I don’t understand why when using variables in Lua.DoString an error appears, and if not then everything is fine ok. I will be glad to know if someone helps.

Can i use wManager.Wow.Helpers.MailMail.SendMessage() to send letters without items? I already tried and nothing went...

 

 

  • Author
1 hour ago, Sye | SMoKie said:

Paste your code

 

var name = "qq";
var subject = 123;
var text = "1\n2\n3\n4\n5\n6";
//Lua.LuaDoString(@"SendMail('qq', '123', '1\n2\n3\n4\n5\n6')"); //without
Lua.LuaDoString(@"SendMail('"+name+"', '"+subject+"', '"+text+"')");
//Lua.LuaDoString(@"SendMail('"+name+"', '"+subject+"', '1\2\3\4\5\6')"); // with the introduction of variables

 

Why are you using @ in a non-multi-line string?
This isn't a problem with LuaDoString.

 

//next time take a look at your ingame Lua errors and you'll see what's actually appearing in the game and why it's a problem
var name = "qq";
var subject = 123;
var text = "1\n2\n3\n4\n5\n6";
Lua.LuaDoString("SendMail(\"" + name + "\", \"" + subject + "\", \"" + text + "\")"); // don't use  @ in combination with \n otherwise at least double escape \n as \\n
// also, don't mix ' with ", you're bound to run into issues with names containing ' eventually

 

2 minutes ago, Matenia said:

Why are you using @ in a non-multi-line string?
This isn't a problem with LuaDoString.
 

Was just typing out a message lol. One can also use Environment.NewLine in C# if that's easier.

  • Author
1 hour ago, Matenia said:

double escape \n as \\n


thanks for the help, this solved the problem

1 hour ago, Marsbar said:

One can also use Environment.NewLine in C# if that's easier.

var text = ""+System.Environment.NewLine+"1"+System.Environment.NewLine+"2"+System.Environment.NewLine+"3"+System.Environment.NewLine+"4"+ System.Environment.NewLine+"5"+System.Environment.NewLine+"6";

In dev tools:

image.png.7bf629a85f4b07429081568bd3b00b1e.png

 

in game

image.png.54cccfa0730a670fa6bf2a00c9df9439.png

 

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.