Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

"Inject" value into a string?

Asked by 6 years ago

I know you can do

local value = "iLord"
print("my name is "..value.." and I love pizza")

which would print: my name is iLord and I love pizza

But in JavaScript you can do

console.log(`my name is ${name} and I love pizza`)

(console.log is the same as print)

Which would print the same thing, is there a way to do this in lua?

1 answer

Log in to vote
0
Answered by
Azarth 3141 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

There's nothing embeded like that to perform string Interpolation.

print( string.format("my name is %s and I love pizza", value) )
Ad

Answer this question