Jump to content




[Lua] Print Quotes


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

#1 Sirharry0077

  • Members
  • 23 posts

Posted 16 February 2013 - 07:58 AM

How would you go about doing the following without error?
print("Type "exit" To Exit")


#2 NDFJay

  • Members
  • 216 posts
  • LocationLeeds, England

Posted 16 February 2013 - 08:16 AM

simple fix, use this
print('Type "exit" to exit')

There's two types of string syntax for printing, there the single quote ' and double quote " if you want to print a double quote the surround the rest of the string in a single quote and visa versa

Hope this helps you

#3 LBPHacker

  • Members
  • 766 posts
  • LocationBudapest, Hungary

Posted 16 February 2013 - 08:34 AM

And of course you can just escape it
 print("this is a quotation mark: \" - what a surprise!") 


#4 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 16 February 2013 - 08:43 AM

I'll go ahead and add that you can use double brackets too. They're best for strings in multiple lines, and maybe if you want to use both double and single quotes.

s = [[ a string
with mutiple lines
with 'single' and "double" quotes! ]]


#5 Sirharry0077

  • Members
  • 23 posts

Posted 16 February 2013 - 08:47 AM

Thx guys everything you posted is helpful.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users