Adding " " around text?
KingofGamesYami 22 Apr 2014
So, I was originally going to use textutils.serialize(string.sub(format)) to do this, but I doubt that would work now since it would return 'string.sub("format")' I think. Is there any other way of doing this or is it impossible? I'm working on creating a file format based on html & BBC.
Edit: nvm, I'm a moron... It's going to return a string anyway (Duh)
Edited by KingofGamesYami, 22 April 2014 - 02:34 AM.
Edit: nvm, I'm a moron... It's going to return a string anyway (Duh)
Edited by KingofGamesYami, 22 April 2014 - 02:34 AM.
Bomb Bloke 22 Apr 2014
If you ever do need to put quotes in strings, stick the good 'ol backslash escape character in front of them.
Eg:
Eg:
print("\"text\"")
TheOddByte 23 Apr 2014
Bomb Bloke, on 22 April 2014 - 07:45 AM, said:
If you ever do need to put quotes in strings, stick the good 'ol backslash escape character in front of them.
Eg:
Eg:
print("\"text\"")
print( '"Hello World!"' )As you may have noticed I started wrapping the text with a single quotation mark then used a double since that's what's going to be printed, You can ofcourse do the opposite way around :3
Lyqyd 23 Apr 2014
local str = [[Of course, "block quotes" don't care about what's inside them and are probably the easiest way to create complex string literals.]]
TheOddByte 25 Apr 2014
Lyqyd, on 23 April 2014 - 07:27 PM, said:
local str = [[Of course, "block quotes" don't care about what's inside them and are probably the easiest way to create complex string literals.]]
print[[ Blah blah, this is some text this is a new line etc. ]]So that you don't have to assign it to a variable
Lyqyd 25 Apr 2014
Sure, you can use them like any other string literal without issue, as far as I know. You might want to include a space after the print, but it should work fine.