Difference between ‘ and ” within Lua

Nope. No difference, except that you can enclose the other inside the ones that you are using.

-- No difference between these
myStr = "Hi!!"
myStr="Hi!!"
myStr = [[Hi!!]] -- The 'weird' way to make a string literal IMO...

-- Double quotes enclosed in single quotes    
myStr="My friend said: "Hi!!""

-- Single quotes enclosed in double quotes
myStr = "My friend said: 'Hi!!'"

-- Single and double quotes enclosed in double brackets
myStr = [[My friend said: "What's up?"]]

See: Strings in Lua for more information.

Leave a Comment