Pudge 24 Posted May 21, 2020 Share Posted May 21, 2020 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... Link to comment https://wrobot.eu/forums/topic/12178-c-variable-in-luadostring-gives-lua-error/ Share on other sites More sharing options...
TheSmokie 242 Posted May 21, 2020 Share Posted May 21, 2020 Paste your code Link to comment https://wrobot.eu/forums/topic/12178-c-variable-in-luadostring-gives-lua-error/#findComment-58314 Share on other sites More sharing options...
TheSmokie 242 Posted May 21, 2020 Share Posted May 21, 2020 I’m heading to sleep, this might help https://wowwiki.fandom.com/wiki/API_SendMail Link to comment https://wrobot.eu/forums/topic/12178-c-variable-in-luadostring-gives-lua-error/#findComment-58315 Share on other sites More sharing options...
Pudge 24 Posted May 21, 2020 Author Share Posted May 21, 2020 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 Link to comment https://wrobot.eu/forums/topic/12178-c-variable-in-luadostring-gives-lua-error/#findComment-58316 Share on other sites More sharing options...
Matenia 628 Posted May 21, 2020 Share Posted May 21, 2020 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 Pudge and Marsbar 2 Link to comment https://wrobot.eu/forums/topic/12178-c-variable-in-luadostring-gives-lua-error/#findComment-58317 Share on other sites More sharing options...
Marsbar 228 Posted May 21, 2020 Share Posted May 21, 2020 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. Pudge 1 Link to comment https://wrobot.eu/forums/topic/12178-c-variable-in-luadostring-gives-lua-error/#findComment-58318 Share on other sites More sharing options...
Pudge 24 Posted May 21, 2020 Author Share Posted May 21, 2020 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: in game Link to comment https://wrobot.eu/forums/topic/12178-c-variable-in-luadostring-gives-lua-error/#findComment-58319 Share on other sites More sharing options...
Matenia 628 Posted May 21, 2020 Share Posted May 21, 2020 Because you're on windows, where newline is \r\n Link to comment https://wrobot.eu/forums/topic/12178-c-variable-in-luadostring-gives-lua-error/#findComment-58321 Share on other sites More sharing options...
zzzar 13 Posted May 21, 2020 Share Posted May 21, 2020 why don't just use wManager.Wow.Helpers.Mail.SendMessage? Link to comment https://wrobot.eu/forums/topic/12178-c-variable-in-luadostring-gives-lua-error/#findComment-58324 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now