3057 posts
Location
United States of America
Posted 22 April 2014 - 02:51 AM
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 on 22 April 2014 - 01:34 AM
7083 posts
Location
Tasmania (AU)
Posted 22 April 2014 - 08:45 AM
If you ever
do need to put quotes in strings, stick the good 'ol backslash escape character in front of them.
Eg:
print("\"text\"")
1852 posts
Location
Sweden
Posted 23 April 2014 - 08:06 PM
If you ever
do need to put quotes in strings, stick the good 'ol backslash escape character in front of them.
Eg:
print("\"text\"")
And if I'm correct this would also work
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
8543 posts
Posted 23 April 2014 - 08:27 PM
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.]]
1852 posts
Location
Sweden
Posted 25 April 2014 - 05:30 PM
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.]]
You can also do this right?
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
8543 posts
Posted 25 April 2014 - 05:34 PM
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.