Is there a way to iterate through something's properties without going through them manually?

Let’s say I wanted to put all the properties of an object in a dictionary. Is there a way to iterate through all of it’s properties? I’d rather not go through each property manually.

From my knowledge, the simple answer is no.

But, you could define property tables once for specific object classes and use them for your iteration, maybe something like this:

local part_properties = {
"Transparency";
"Size";
"Color";
}

for i, property in pairs(part_properties) do
print(script.Parent[property])
end
1 Like

Ehhh the thing is I’d rather not do something like that. I was kind of hoping that there was some built in function that returns all the properties of a part in a table or something.

1 Like

I see.

Out of curiosity, why do you need this functionality??

1 Like

Just to check if there is a clone of an object in the game. I would ideally get all the properties of an object and iterate through everything in the game checking if the properties are the same.

1 Like

You can’t get every property in code, you’d probably manually record property names.

For checking if an object is a clone, just have a value represented in the original that wouldn’t change if it was cloned?