Strings
Lua strings can be used to store and modify text. Strings can be created in a few ways:
"this is a string"
'this is also a string'
[[
this is a multiline string
this is still a string
]]
Combining Strings
There are a lot of cases where you want to combine multiple strings. You can do this by adding .. between the two strings.
In this example, we use .. to combine "x: " and my.layout.x. my.layout.x is a number, but it gets automatically converted to a string when combined with another string.
Try dragging to move the Character, and you can see how the text updates:
The deck contains the default "Character" blueprint with a script added. There is also a Text blueprint with the tag "text".
Library Functions
Lua has a library with functions that work with strings. For example, we can use string.reverse("hello") to get back the string "olleh". You can see a list of all of the library functions here.
The deck contains the default "Character" blueprint with a script added. There is also a Text blueprint with the tag "text".