I know strings are immutable in Lua, I was googling around for a while and while changing a string in anyway simply creates a newly allocated string, does assigning/passing in to a function make a full copy of the string as well?
Say I have the following examples
local strA = string.rep(“a”, 12800) --100kb string
strB = strA
–Are there now 2 100 kb strings in memory?
–Again, was a new 100kb string allocated and pushed onto somefunction’s stack?
If the answer to those questions is yes, then how can something so absurd not be compensated in lua? Is there no way to handle a large string efficiently in lua? I realize if I convert the string to a integer table containing the string’s bytes as keys that would be more efficient to work with (I do this when building large strings from lua).However, there is no default lua function to take an existing large string and convert it into a table which means there is no fast way to do it and thus that solution is futile without a custom library.