Jump to content




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


  • You cannot reply to this topic
2 replies to this topic

#1 tesla1889

  • Members
  • 351 posts
  • LocationSt. Petersburg

Posted 27 June 2012 - 04: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

#2 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 27 June 2012 - 04: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.

#3 tesla1889

  • Members
  • 351 posts
  • LocationSt. Petersburg

Posted 27 June 2012 - 04:48 PM

ah, ok. thank you!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users