On Wed, 25 May 2022 19:42:12 +0000 (UTC)
Hector Vido <firstname.lastname@example.org> wrote:
> ... But I think this is
> explained in that way because of string concatenations. If you do
> something like this inside a loop: myName = myName .. 'blah'
> This will leave a lot of "new strings" in memory to be cleaned by
> the garbage collector, instead of just "replace" the value of
> "myName" variable.
Thank you Hector for your explanation.
I tested it in the Lua REPL:
myName = 'hector'
myName = myName .. ' vido'
print(myName) => hector vido
So the char array "myName" has a new value. Correct?
and there is now an abandoned char array that contain only 'hector'?
which the gc will eventually destroy?
** Bottom posting text only is the netiquette way! **