The module itself is very simple, but some people might not know enough about metatables to know how to do this, so I thought I’d post this as a resource.
nice!
very cool i love it, personally I am not the scripter, so I don’t know whats the advantage of this to getter and setter functions (I don’t even know what those are lol)
The issue with the code example is that they’re overwriting the workspace global, which unless you’re trying to proxy the variables for reverse engineering, really should not be done.
The example should be more like
local workspaceWithAttributes = MakeAttributesIndexable(workspace)
Just so that you can understand a bit, attributes are kind of like custom properties, like you see with “Position”, “Name”, etc. But attributes don’t let you just do: workspace.CustomAttribute for example. They decided not to for multiple reasons, but mainly because the method above was already used for a lot of other stuff too at the same time.
But anyways, instead, they decided to have a function which you change a attribute, and one to get an attribute, so instead you need to use :GetAttribute() and :SetAttribute(), doing this was better than using “.”, But it turns sometimes, inconvenient.
This instead let’s you use “workspace.CustomAttribute” for example, instead of using the methods I showed above.
If you don’t understand ANYTHING about scripting just know that using “.” means either you’re getting something inside of something else, so workspace.Part for example would get a part inside workspace, and that’s basically it, but using “.” is also for properties and stuff like that, so they decided to NOT use “.” for attributes.
Yeah, I know the basics like referencing and variables, and I know that attributes are like custom properties as it was explained, I just didn’t know what getter and setter were.