Strings

Simple string assignment and concatenation can be performed directly in Lua. More advanced string manipulation is available using the string module (included as part of the Feko installation).

Strings are concatenated using two full stops (“..”). The “#” operator returns the length of the string. The string module should be used for more advanced string manipulation such as substitutions.

print("Here is a string" .. ' concatenated with ' .. 2 .. ' other strings. ' )
a = ' hello '
print( ' The # operator says there are ' .. #a .. ' letters in " ' .. a .. ' ". ' )
print(a .. ' becomes ' .. string.gsub(a, ' h ' , ' y ' ))