[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: table.concat - why so complex?
- From: Florian Weimer <fw@...>
- Date: Tue, 06 Apr 2010 19:24:46 +0200
* Martijn van Buul:
> My naive solution would be simple: Iterate over the array, add the
> string length of its members, add the required storage for any
> supplied separator, allocate the target string to the right, and
> memcpy() the array members (and any separators) over to their final
> location. Required memory overhead: None.
concat needs to convert numbers to strings. This requires allocating
new strings (at least with the usual APIs), and those have to be
stored somewhere.