lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> In case it comes up for you, table.concat() is another library
> function that is much more efficient than concatenating large numbers
> of strings into one big string using the .. operator. And the manual
> says this about it:
> 
> "Given an array where all elements are strings or numbers, returns
> table[i]..sep..table[i+1] ··· sep..table[j]. (...)"
> 
> While it *does* return the equivalent of that, it is more efficient in
> how it goes about it.

Actually it is not :)  Remember that if you write "a..b..c..d" (as one
single expression, as the description above) Lua does the entire
concatenation in one single operation, allocating a buffer large enough.

-- Roberto