[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: What is the fastest way to concatenate here?
- From: "Alexander Gladysh" <agladysh@...>
- Date: Thu, 22 Jun 2006 22:42:21 +0400
Hi, all!
ISuppose I have a table of functions. Each of functions returns the
string (different one). I need to concatenate all results into one
large string.
I've read somewhere, that table.concat() is faster that series of
separate concatenations. So, is following approach faster than
concatenation in a loop?
foo = function(funcs)
local t = { }
for _, fun in pairs(funcs) do
table.insert(t, fun())
end
return table.concat(t)
end
Or is there more elegant way to do what I want (still, in this case
I'd prefer elegancy over speed ;) )?
Thanks in advance,
Alexander.