Is Roblox programmed in Lua? Questions about Instance

Hello developers :slightly_smiling_face:,

I was trying to get all of the properties of a part (without HTTPService).

I don’t need it for something specific, just testing.

I thought to myself if ModuleScripts are just tables, and I can loop through them and see what’s in them. Can I do the same with Instances (Since module scripts are just tables)?
Basically, if an Instance (like part) was just a table (Like module scripts), I would be able to loop through the table.
image

image

image
But I got the Exception: (table expected, got Instance) as I expected, but isn’t Instance a table?

image

If not, what is it then? Lua doesn’t have a keyword like classes, OOP is done by tables and metatables.

So, Instance is something else, not a table, so I thought of Java (another language I know a bit of).
You can’t loop through a Java class, only through an Array (or Vector, ArrayList, etc).
All of the private variables remain hidden. Is it the same case here? The Instance is programmed by another language that contains classes (or something similar) and everything (like private variables) remains private?

Are Roblox and the Instance programmed by another language? Is there a way to get the properties of an Instance without a Service or something external?

One thing I am sure about, Instance doesn’t exist in pure Lua (outside of Roblox).

Thanks for answering, I might have reached the wrong conclusions :sweat_smile:, just let me know :slightly_smiling_face:

3 Likes

It is lua, and I have made a property retriever and loader if it you want it.

Properties have to accessed this way e.g game.workspace.Part.Name

1 Like

Instances are one of many types of userdatas in Roblox, not tables. Userdatas and tables are different things in Lua.

2 Likes

What if I want to get an array of all of the properties?
Without HTTPService and with any instance, not just part.

And you can’t access userdatas, they are like private tables? I looked them up and not sure that I understand.

Look at this Client Dump Parser by csqrl.

1 Like

No.

Roblox is programmed in C++.
Lua is an embedded language which essentially means it allows other users to interact with their program. Lua: an extensible embedded language

I think this function will be able to do what you want, just it hasn’t been released yet.

I think this module might be able to do what you want:

3 Likes

Thanks for answering :slight_smile:, I’ll further look at it when I am able to go on my computer.

you would have to use pcall to check for every property in game

Ive done something similar.
its a lot of lines of script so I made a script to repeat the same sort of thing for over 200 and something properties

Wouldn’t a dictionary with classnames as keys attached to dictionaries with property names would be more efficient rather than checking for 200 properties at once with a loop?

it wont be looping. Ive effectively bypassed the limit of locals I can use so I can pcall for each property. It is very fast at getting all properties and does not require looping.

But making a dictionary wont really work as you cant pull the names of properties only the values. And you cant really tell what is what as many use the same values like Vector3 for Velocity and Position.

you could try to use a dictionary but it wouldn’t be as fast or worth the time. It would end up with a bunch of nils or errors.

I uploaded my scripts into a model. You can read the entire thing and editing is allowed (Just give credit where its due)
https://www.roblox.com/library/5817096378/Part-Saving-And-Loading

Attributes are essentially user generated properties. They won’t give you a list of all the part’s properties, just the ones that you’ve created using SetAttribute.

4 Likes

Not gonna lie, Instance’s are just tables but a very modified version of it, at least it works like that.

1 Like

At current pretty much.
It would be a bit like a dictionary really.
{
[“Name”] = “Part”,
[“Size”] = Vector3(2,1,4)
}

However this is locked in by roblox so the property table cannot be edited. A read only copy would be helpful but this is more of a discussion that should be had on feature requests.

Instances are just userdatas with a metatable, not really a table. You can’t use rawset or rawget on them, so it really isn’t right to call them tables

1 Like

Thank you all for answering :slight_smile:, to be honest, I am not sure which answer I should mark as a solution so I’ll name this [Solved].