Hi!
I'm attempting to format a string using the text [[ ]] thing. I have come across unexpected behavior that I don't know how to solve.
local a = [[Potatos = %s
Carrots = %s
]] -- This is a multi-line text.
string.format(a, "YES", "NO") -- Format the a string with string.
print(a)
-- Result:
-- Potatos = %s
--Carrots = %s
--Expected result:
-- Potatos = YES
-- Carrots = NO
How would I get this to print like this? I've looked at so many wiki articles and nothing seems to be working.
Thanks, Nathan.

2 comments
(Minor) To be even shorter, you can take out the word 'tostring' (though you still need the parentheses). It should end with a newline to be consistent with the string block, though
Fantastic answer! Thank you very much, can't believe it was that simple.