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

Using "\" individually without string commands

Started by RadiationAlert, 07 June 2015 - 08:03 PM
RadiationAlert #1
Posted 07 June 2015 - 10:03 PM
I'm trying to see if a string is equal to "\"; but that is obviously trying to run a string command like \n and thinks that the string is unfinished. Is there a way to prevent that from happening?
wieselkatze #2
Posted 07 June 2015 - 10:14 PM
You're probably searching for something like this:


if yourString == "\\" then
  --# Do stuff
end

A single backslash would indicate that the " is escaped. This way you would escape the backslash and check if the string is equal to the latter.
Edited on 07 June 2015 - 08:14 PM
RadiationAlert #3
Posted 07 June 2015 - 10:15 PM
That's exactly what I was searching for.