Feature Request / Scripting / .name

Hey!

I’ve recently been learning how to write Luau and a few times I’ve ran into issues where it would be great to be able to reference the name of something, in particular VM properties. This has made the scripts that I’ve built feel a bit clunky where the user needs to add / update an an array like this:

local propertyNames = { 'shape1', 'shape2', 'shape3', 'shape4', 'shape5' }

in order to cycle through properties in a for loop, like this:

for _, i in ipairs(propertyNames) do

local prop = viewModel:getViewModel(i)

if prop and prop.value then

table.insert(self.seeds, {

name = i,

seedX = math.random() * 1000,

seedY = math.random() * 1000,

})

end

If we could have access names we could write something like this:

local propertyNames = {}
for _, child in ipairs(viewModel:getChildren()) do
table.insert(propertyNames, child.name)
end

to capture them and then it would therefore automatically update when new properties are added to the VM.

Thanks for considering this request.

Matt