Quote from yssarilif i remember right lua stores all strings in a hash so once created they are good to go and i think the bottom way is faster since you don't have the function call but a straight concat.
But the concat costs some time, and it has to do in two parts.. if valOne=1 and valTwo=2 then lua first has to do (1 .. "/") = "1/", and then ("1/" .. 2) = "1/2". If "1/" wasn't already in memory, it has to allocate it on the spot, and then probably GC it again later.
If you're worried about it, test it. It's easy:
do local n = 1000 local GetTime = GetTime local text,t0,t1 collectgarbage() t0 = GetTime() for i=1,n do text = "%d/%d":format(n,n+1) end t1 = GetTime() print(n,"format()s = ",(t1-t0),"seconds") collectgarbage() t0 = GetTime() for i=1,n do text = n .. "/" .. (n+1) end t1 = GetTime() print(n,"concats = ",(t1-t0),"seconds") end
Increase n until you're getting long enough times to compare (say, .5 seconds) and see which is faster.