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

[Solved] problem with '/' and '\' in print()

Started by Kunzite, 02 March 2013 - 09:33 PM
Kunzite #1
Posted 02 March 2013 - 10:33 PM
Title: problem with '/' and '\' in print()

Hi, I'm fairly new to lua. I am trying to make my program generate a pretty border for it's UI.
When executing:
print(" /\ \")
and/or
write(" /\ \")
I get an unfinished string error. I know that this is caused due to the multiple /'s and \'s in the same string. I believe one of them is used to denote a new line? In other languages there are ways/symbols you can use to make the program ignore these characters in the string, is there something similar in Lua?

-snip- (long way of typing it out does not solve problem)

Thanks in advance.
Bubba #2
Posted 03 March 2013 - 06:24 AM
You can use a double backslash "\\" in order to print a single backslash "\". A single backslash in combination with another character such as \t or \n is used to denote newlines and tabs and the like.
Kunzite #3
Posted 03 March 2013 - 10:16 AM
Thanks a ton Bubba! :)/>