Well, there does not seem to be any way of traversing the tree without GetChildren, since that content is completely dynamic.
By contrast, if you know the type of the instance, you know all properties that it has statically.
I think the only compelling usage example is custom serialization.[/quote]
That’s true. At the time I had some kind of complex idea that you could use the descendant API to loop through things and organize it based on that. That would be very unpractical though compared to :GetChildren()
[quote] For the GetProperties() and SetProperties()
How would you represent nil?
I like GetProperties(), or any other method to get data from the API Dump.
That would be amazing, a new service “WikiService” or “ClassService” or “API Dump Thingy Service”.
That would just have methods as GetAllClasses(), GetClassHierarchie(), GetProperties(class), …
(A bit as I did in: Documentation - Roblox Creator Hub Other wiki people already altered it a lot) [/quote]
:GetProperties() would probably just return nil if you give it an invalid parameter.
If :SetProperties() doesn’t find any matches within the properties table then it would do nothing and issue out an error.
[quote] The other big use case is plugins. In fact, I just wrote an API Dump → Giant Lua table parser just today to use in a plugin that I’m making, which will take a selected object in the game hierarchy, and generate a ModuleScript which when called creates the object in question. The idea being that the generated module is actually in a human-readable format, so that you can make further modifications to it in code.
Another example where we’ve needed a way to get metadata on the games team several times: In a “CreateShadowText” function. We need to know what properties to copy over to the shadow text objects when the original text object changes and what properties to not copy over because they are actually changes to locked / readonly properties, but we have no way of doing that without using a hard-coded lookup table of special cases, or by using pcall on every single property change. [/quote]
Thanks for providing some examples Stravant! I didn’t actually think of that.
These API additions wouldn’t be used all the time, but in special cases like what Stravant explained and for serialization purposes I could see these being useful. It’s true that you know what properties it has, but at first, but you may not know the values or need to keep track of the initial properties of multiple different objects as they dynamically change. And as I said, there is no simple way to get all of the properties at once, or a specific group easily without spending a bunch of time writing special property checking code.