How To |Insert a Variable in a String Using LUA

Learn how to insert variables into strings using LUA.

Updated at February 26th, 2024

Procedure


Some configurations may require a variable inside of a string. To accomplish this, you need to have “..” before the variable name. 

gain = 12
print("the output gain is currently set to: " ..gain)

If you need to continue the string after the variable, you wil all insert two “..” after the variable. 

door_status = “open”

print("the door is currently “ ..door_status.. ”. You should close it.")

Helpjuice Info Callout Title

Without the spacing inside the quotes, the string would print: “the door is currentlyopen. You should close it.”