Am 25.08.2015 um 16:29 schrieb Patrick Donnelly:
On Tue, Aug 25, 2015 at 7:14 AM, Rena <hyperhacker@gmail.com> wrote:
Lua strings are immutable (they can't be changed), so there should
never be
multiple copies of a string in one Lua state[1].
[...]
[1] for very short strings it might keep multiple copies when this
would be
more efficient than keeping references, but this is an implementation
detail
that we don't need to know about. :-)
You have it reversed. Lua may have multiple copies of large strings
but not short strings (len(s) <= 40):
http://www.lua.org/source/5.3/lstring.c.html#luaS_newlstr
Ok now i am completely confused.
After reading your linked source i am back at my starting point, asuming
the only value assigned by reference is a table/list. All other are
assinged by value. So a
_stringvar1= stringvar2_ creates a copy of the source string.
(still assuming we are talking about strings of size 1kB+ as in my
program.)