(text: …[ Number or String or boolean or Array ]) → String

Also known as: (string:)

(text:) accepts any amount of expressions and tries to convert them all to a single String.

Example usages:

Rationale:

Unlike in Twine 1 and SugarCube, Twine 2 will only convert number into string, or strings into numbers, if you explictly ask it to. This extra carefulness decreases the likelihood of unusual bugs creeping into stories (such as adding 1 and “22” and getting “122”). The (text:) macro (along with (num:)) is how you can convert non-string values to a string.

Details:

This macro can also be used much like the (print:) macro - as it evaluates to a string, and strings can be placed in the story source freely,

If you give an Array to (text:), it will attempt to convert every element contained in the array to a String, and then join them up with commas. So, (text: (a: 2, "Hot", 4, "U")) will result in the string “2,Hot,4,U”. If you'd rather this not occur, you can also pass the array's individual elements using the ... operator - this will join them with nothing in between. So, (text: ...(a: 2, "Hot", 4, "U")) will result in the string “2Hot4U”.

See also:

(num:)