lua-users home
lua-l archive

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

On Thu, Mar 27, 2014 at 2:10 PM, Coroutines <> wrote:
> A linked list of Lua strings has the potential to
> contain many smaller, intermediate strings and avoid moving strings in
> memory.

these are called 'ropes'  and have
well-known advantages over simple strings, but most of them are easy
to get just by using a Lua array of strings.  insertion/deletion is
O(n), but here 'n' is the number of elements, which shouldn't be too

usually, functions that build complex strings do it by populating an
array and string.concat()'ing it at the end.  sometimes you can get by
simply by skipping that last operation.

i don't quite get your paragraph about GC'ing rope elements, if the
rope isn't collectable, an element isn't either.  if elements are
shared, then they're collectable once they cease to belong to any
rope, just like common strings.