|
My naive solution would be simple: Iterate over the array, add the stringlength of its members, add the required storage for any supplied separator, allocate the target string to the right, and memcpy() the array members (andany separators) over to their final location.
Whilst simple, it falls down when presented with __concat metamethods or numbers.