lua-users home
lua-l archive

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


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

-- 
Patrick Donnelly