Change name of a copied table?

If I have a copied table, how can I modify its name using scripts?

For example, I’ve got this table:

local original = {
key = "value",
engine = "Roblox",
playerID = 505306092
}

And then I use this function to create a copy of my table:

local function shallowCopy(original)
	local copy = {}
	for key, value in pairs(original) do
		copy[key] = value
	end
	return copy
end

local clone = shallowCopy(original)

How do I change the table name of clone?

This question doesn’t make sense, tables are anonymous, which means they don’t have names. Can you clarify ?

1 Like

In my example, the name of my table

local original = {
key = "value",
engine = "Roblox",
playerID = 505306092
}

would be “original”, thats what I mean. Would I be able to somehow change that name?

1 Like

That’s the variable’s identifier, not a “name”

local function shallowCopy(original) -- this is just a parameter name
	local copy = {}
	for key, value in pairs(original) do
		copy[key] = value
	end
	return copy
end

local clone = shallowCopy(original) -- you technically "renamed" it to "clone"
-- use the "clone" variable and not the "original" variable
1 Like

Variables are not really names, unless they are fields in a dictionary. If you want to change the variable name, just do something like that

local neworiginal = original

Even though there isn’t really a point in doing this

1 Like