PDA

View Full Version : String Concatenation [Solved]



MooCow
January 5th, 2020, 19:11
I'm looking to add "• " before a text that I've retrieved from a label with the getValue() function post-layout, hopefully from a template. (Yes, I can just add "• " to every single entry, but it would be neater if a script would work instead.)

I quickly came up with this:


local sText = getValue();
setValue("• "+sText);

The code itself works, except that FG complains that I can't perform arithmetics with strings.
...so how do I do that? Can it be done? Is there a function like setString() or mergeString()?

Update:
Nevermind! Found it. The symbol for string concatenation is "..".

Ikael
January 5th, 2020, 19:22
In Lua you use two dots to concatenate strings. For instance

"foo" .. "bar"
or in your case

setValue("• " .. sText);