lua-users home
lua-l archive

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

Hi, wrote:
> Solution (in implementation of string.gsub): In case the replacement has
> the same size as the key word (which is to be replaced), the
> search&replace could be done directly in the original string without the
> need to create new strings. This would increase speed significantly and
> decrease memory usage.

Lua strings are immutable and shareable. You can't modify them in-place.

> Sorry for not implementing that myself, but unfortunately I cannot
> tackle this issue right now.

If you had tried, the compiler would have complained. Lua strings
are exported as 'const char *'.