Using lua to print newlines | Using lua to print newlines |


Using lua to print newlines


I am assigning the content of a textedit in lua, and am trying to insert newlines into the textedit, with no success.

I find that '\n' is ignored (but visible as a garbage char in the trace output) and '\r' results in a garbage character getting printed.

Here's a couple of sample lines of code.

cLog = wstring.tostring(cLog) .. '\n\r' .. str
ui.vfsWrite(functionOrNode, cLog)

Where functionOrNode is pointing to the VFS node that the textedit is using for its content.

Also, note that I have tried setting the content of cLog to both a string and a wstring, but the results are identical.

The equivalent first line for that is:

cLog = .. '\n\r' .. str)

Please let me know how to get a newline into a textedit.