lua-users home
lua-l archive

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


> For a language like Lua I think a better solution to performant string
> construction would be something like Java's StringBuffer. This is trivial to
> do in Lua because the language emphasizes making use of the C API, and
> userdata objects are first-class in terms of language treatment. The real
> issue is that the Lua ecosystem isn't a batteries included kind of
> environment.

Many people (including me) use tables in place of string buffers. To add
an item to the buffer, we simply do 't[#t + 1] = item'. The expression
'table.concat(t)' produces the final string.

-- Roberto