Tables are passed by reference, so the same table in memory is pointed to by both variables. This is unlike, for example, numbers, which are passed by value.
Notice that if you print both table variables, they have the same hash.
They are the same table. Assignment of tables is by reference, a copy is not made. It is the same for “objects”; if you have part = Instance.new("Part") and part2 = part, they are the same part.
You would. This often involves iterating through the table and taking key-value pairs from the first table and placing them into a second. The Lua-Users Wiki has some good implementations for copying tables:
There are some other options to use a table as a template or such that don’t require you to actually copy it. For example, you can create a ModuleScript of the table and just require that when you need one. It would be useful to have a deepcopy function on hand though.
That’s right, I forgot. And string functions take the string and produce a new one with the changes applied to them. Removed the string mention from my post.