lua-users home
lua-l archive

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


On 02/01/14 13:38, Javier Guerra Giraldez wrote:
> On Thu, Jan 2, 2014 at 5:29 AM, Scott Morgan <blumf@blueyonder.co.uk> wrote:
>> You might want to look at the 'rope' patten.
>>
>> http://en.wikipedia.org/wiki/Rope_%28computer_science%29
>> http://lua-users.org/wiki/LuaRopes
> 
> 
> definitely ropes are the answer for efficiently working with big text
> contents, and LuaRopes implement most of the pattern as described on
> the paper (a tree with strings at the leaves)
> 
> but in many cases, i've found that a simple array of strings works
> beautifully as a "poor man's rope".  just pass around the array, and
> at the end either output in a loop or call table.append() to create
> the string just once.


Definitely, the binary tree stuff is overkill when Lua presents such a
simple solution with plain tables.concat

Scott