API Method to easily get the properties of an object

[quote] Another use would just be serialization methods for datastores.
Ex: Stravant’s Instance Encoder module and Merely’s Online Studio uses a parsed ReflectionMetadata that needs to be updated for new features. [/quote]

Mine just uses the API dump, which is retrieved from http://anaminus.github.io/rbx/raw/api/latest.txt
It seems to successfully encode and decode most properties, and I haven’t had any issues just yet. The only time where an issue could occur is when the API dump changes order, and it doesn’t seem as if that’s going to happen any time soon.

I still think this needs to be a thing. At least :getproperties()
Even if it has limited use cases so does a lot of the rest of the API. It makes those use cases a heck of a lot easier.
APIs are about simplifying those complex processes or having a standardized way of doing it.

2 Likes

What are you doing and why do you need this feature to do it?

If something like this were implemented, I would prefer a method that gets documentation on a class. It would feel like API bloat though; I’d be especially hesitant to add new properties/methods to everything because if someone had an instance in a folder of that name it would break this code: “require(script.Parent.GetProperties)”

I’d rather have something for plugins to get a machine-readable API dump tbh

Shouldn’t have to rely on the API dump.[quote=“Tomarty, post:25, topic:7536, full:true”]
What are you doing and why do you need this feature to do it?

If something like this were implemented, I would prefer a method that gets documentation on a class. It would feel like API bloat though; I’d be especially hesitant to add new properties/methods to everything because if someone had an instance in a folder of that name it would break this code: “require(script.Parent.GetProperties)”
[/quote]

Look at previous examples. Plugins and serializations are key use cases.
Adding anything is bound to break someone’s code.

Why? It provides exactly the information you’re asking for and more?

1 Like

I shouldn’t be limited to names of properties without important information about inheritance and security context.

2 Likes

Because you still have to manually parse it when on the C++ side ROBLOX doesn’t.
By that point you might as well just grab it off the wiki.(Manually or httpservice)

The point of the API is to grab the properties and not have to parse the entirety of the metadata.
API method could have parameters to lift those limitations.

1 Like

ROBLOX could provide it in tabular form as they do for various other methods (e.g. GetGroupInfoAsync)

1 Like

Not viable because you’d need to update the plugin every week.

Not viable because it relies on HttpEnabled.

Emphasis on machine readable. It could either be delivered as a json table or a lua dictionary.

2 Likes

Oh, no, this topic again :frowning:
So… what would be the order of applying properties from such a table? Any design insights?

2 Likes

Sure thats viable.

I don’t think it matters with the order if you can easily differentiate them like with what Fractality mentioned.
He proposed the idea of a machine-readable metadata so ill let him answer that.

Sorry it was presented so poorly in the OP, but having access to the API dump is actually a pretty useful feature. Use cases:

  • Create a class converter (e.g. Part to WedgePart) that doesn’t need to be manually updated every time API for these objects changes
  • Useful for when I create an object only to find I need a different class later, a feature that has accumulated nearly 100 votes on the ROBLOX Trello
  • If “foo” was added as a property to BasePart and I set it to 3, and then converted (via creating a new instance) with a hard-coded list of properties it would be reset to default value since I didn’t know the property existed and to transfer it
  • Plugin that offers this functionality hasn’t been updated since it was released and the above problem is rampant
  • Serialize objects without having to manually update list of properties
  • Plugin that searches script sources and warns developer if they’re using any deprecated methods/properties
  • Lua interpreter plugin that searches script sources and warns when API members are used with incorrect arguments
  • Create a custom properties window for debugging purposes online
  • Re-create intellisense popups in a scripting tutorial game

I’m sure others have different use cases as well – these are only ones that are relevant to me. Having access to the API dump would allow for some really neat stuff.

14 Likes

Hang on, so now this topic is about improving API dump, and not bulk property setter/getter?

1 Like

This topic is about getting metadata about classes. Echo and I are saying that exposing the API dump would be a good way to do that.

3 Likes

In OP the primary thing was to be able to get the properties of an object.
As previously proposed a machine-readable API dump would solve this and more.

The whole :SetProperties() and :GetProperties() stuff isn’t really the main thing wanted here. It’s mostly some way (using methods in ScriptContext or another (or a new) service) to get info about a class(member), similar to the info that’s represented in the API Dump. We basically want a way to get the (up-to-date) API dump, preferably parsed into some table format, similar to (or just like) how the wiki does it:

1 Like

Ah, so you basically want a reflection system, I see. Yeah, I do agree that it might be useful for tool development, however, I do not yet see why it should be present at runtime.

1 Like

Some of my use cases addressed why it’d be useful to have online:

2 Likes

I don’t think this needs to be a runtime feature. An universal online properties window would be overkill, and a live scripting tutorial would need more annotation and guidance than the dump could provide.

Anyway, Anaminus’s dump parser would be a great starting point for the dump table format.

Output sample ``` { { tags = { notbrowsable = true; }; Name = "Instance"; type = "Class"; }; { Class = "Instance"; tags = {}; type = "Property"; ValueType = "bool"; Name = "Archivable"; }; { Class = "Instance"; tags = { readonly = true; }; type = "Property"; ValueType = "string"; Name = "ClassName"; }; { Class = "Instance"; tags = { readonly = true; RobloxPlaceSecurity = true; }; type = "Property"; ValueType = "int"; Name = "DataCost"; }; { Class = "Instance"; tags = {}; type = "Property"; ValueType = "string"; Name = "Name"; }; ```