Learn Lua · Strings · Lesson 1 of 3
Joining text
Text in Lua is a string, written in quotes. Join strings with .. (two dots).
Numbers join too, and become text:
local name = "Ada"
"Hello, " .. name --> "Hello, Ada"
"Order " .. 1042 --> "Order 1042"tostring turns any value into text, which helps when you aren't sure what you have:
tostring(7.5) --> "7.5"
tostring(true) --> "true"What your code receives
Your code gets its data as input. The type Input line at the top of the code lists every field, and the editor uses it to suggest field names and spot typos. Here is an example. Each check sends different values, so work from the fields rather than these exact values.
input = { name = "Ada", quantity = 3, product = "Flyer", price = 7.5 }Steps
- Return
greeting:"Hello, "followed byinput.name. - Add
summary: the quantity," x "and the product, such as"3 x Flyer". - Add
price:"Price: "followed byinput.price.
Show a hint
Spaces matter: "Hello, " .. "Ada" gives "Hello, Ada" because the space is inside the first string.