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

[lua][error] - including a backslash in a string

Started by tesla1889, 27 June 2012 - 03:31 PM
tesla1889 #1
Posted 27 June 2012 - 05:31 PM
hello there. i am trying to make a spinning cursor using the characters "-", "\", "|", and "/". however, when i run the script, i get this error on the line of the assignment for the backslash:

bios:206: [string "#gui"]:9: unfinished string

is there any way to use the key numbers instead of the character itself? or how should i go about this?

thanks
MysticT #2
Posted 27 June 2012 - 05:46 PM
That's because the backslash is the escape character, used to include some special characters in a string. To use the actual backslash you have to escape it:

local s = "" -- string containing a backslash
So, just put two instead of one.
tesla1889 #3
Posted 27 June 2012 - 05:48 PM
ah, ok. thank you!