This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Cakejoke's profile picture

[1.47]"\n" not working with term.write()

Started by Cakejoke, 22 December 2012 - 06:43 AM
Cakejoke #1
Posted 22 December 2012 - 07:43 AM
As then title states, passing a string containing "\n" to term.write won't continue the text on a new line. There will just be a "?" in the output. Strangely, "\t" will work and "\n" works perfectly fine in print().
Cranium #2
Posted 22 December 2012 - 07:55 AM
I think write counts \n as a character. Unless you use term.redirect(), it will not know what to do with that character.
PixelToast #3
Posted 22 December 2012 - 08:13 AM
term.write is the RAW term function
it only shifts the cursor pos on the X axis
write supports newline and will automatically wrap things to the closest space if they are bigger than the screen
Cloudy #4
Posted 22 December 2012 - 08:51 AM
Intended. Isn't it obvious by our special handling in write?
Cakejoke #5
Posted 22 December 2012 - 11:05 PM
OK, I tried write(), but it adds that weird number at the end, and \b for backspace doesn't seem to work in either function.
Cloudy #6
Posted 22 December 2012 - 11:08 PM
"weird number"?
Cakejoke #7
Posted 22 December 2012 - 11:22 PM
lua> write("Test")
Test0
lua> write("Test\nTest")
Test
Test1

That weird number.

EDIT: OK, nevermind, that's just the return value, of course printed in the same line. Derp. =/