[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.
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)”
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.
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.
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
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.
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:
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.
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";
};
```