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

[SOLVED] Can't use "\" in print(" ")

Started by dan14941, 20 January 2013 - 01:18 AM
dan14941 #1
Posted 20 January 2013 - 02:18 AM
I'm in the middle of programming my new OS but in print(" ") I can't use "\" when I do and I run the program the "\" symbol dosent show up please help!
theoriginalbit #2
Posted 20 January 2013 - 02:20 AM
that is because \ is a delimiter/escape character and is used for example to get a " into a string by typing \" … so to get the character \ you must also delimit/escape itself … use \\

uses of the \ http://www.lua.org/pil/2.4.html
Edited on 20 January 2013 - 01:22 AM
remiX #3
Posted 20 January 2013 - 02:20 AM
The \ character is known as the 'escape character' in LUA. For example to go to the next line within a print:
print("Hello\nNew line")

To escape that, do a double \\:

print("\\")
dan14941 #4
Posted 20 January 2013 - 02:22 AM
that is because \ is a delimiter and is used for example to get a " into a string by typing \" … so to get the character \ you must also delimit itself … use \\
The \ character is known as the 'escape character' in LUA. For example to go to the next line within a print:
print("Hello\nNew line")

To escape that, do a double \\:

print("\\")
thanx!