Sad truth
Sad truth is, you can't get these properties without having a reference to every single property that exists within that object. Yes, it is annoying, but it's the only way. For example, if I wanted to print all the properties of a part, I'd first have to store all the existing properties that consists within the Part instance in a table, then iterate that table while indexing the part with a for loop.
Example:
Here's an example of how you could create a function that prints all properties of a part:
local PartProperties = {
"Size","Transparency","Position","CFrame","Reflectance",
"Shape","Anchored","BackParamA","BackParamB","BackSurface",
"BackSurfaceInput","BottomParamA","BottomParamB","BottomSurface",
"BottomSurfaceInput","BrickColor","CanCollide","CustomPhysicalProperties",
"Elasticity","Friction","FrontParamA","FrontParamB","FrontSurface",
"FrontSurfaceInput","LeftParamA","LeftParamB","LeftSurface","LeftSurfaceInput",
"Locked","Material","ResizeIncrement","ResizeableFaces","RightParamA","RightParamB",
"RightSurfaceInput","RightSurface","RotVelocity","Rotation","SpecificGravity","TopParamA",
"TopParamB","TopSurface","TopSurfaceInput","Velocity","Archivable","ClassName",
"Name","Parent"
}
local Part = Instance.new("Part")
local function GetPartProperties(Part)
local Props = {}
for i,v in next, PartProperties do
Props[v] = Part[v]
end
return Props
end
for i,v in next, GetPartProperties(Part) do
print(i,v)
end
API
If you don't want to write these tables yourself, I'm more than positive there are multiple options. Here's a hierarchy of classes you can use if you create a string parser for it: https://raw.githubusercontent.com/ScriptGuider/First/master/Testing
Hope this helped, let me know if you have any questions.
4 comments
So there's no way to get them automatically? Is there a way with http service and the roblox wiki api to do this? Oe is the above really the only way?
Also, what does i,v in NEXT mean. is it the same as pairs?
There are probably sources that contain this information, but none that I've looked into. I was basically just saying the method for doing this is the same no matter what, even if you had access to an API page
Also for the for loop question, I recommend viewing this: http://www.lua.org/pil/7.3.html