Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Being able to have an array custom property #1493
It would be nice if we could add a custom property of type array.
I can't really see use for other datatypes, so just add array as option (which would be an array of strings)
We currently use a comma seperated list to write down which doors a button would open. But this is prone to errors and prefer an array list.
While you can of course write JSON or comma separated values in a string property, I do think it would indeed make sense to support array properties explicitly, though it should ideally allow an array of any available type. Alternatively, the elements in the array could each be allowed to be of any type.
@bjorn What use case would satisfy the need of having any type of array?
Also why heterogeneous arrays? If they need heterogeneous arrays let them add custom properties of that type. This would also add complexity to parsing this, because you need to check for each array item what type it is.
It's fine by me adding those other types of arrays but it would create a huge list of options and maybe make them confused or being not user-friendly.
There shouldn't be much additional complexity to parsing heterogeneous arrays than to parsing heterogeneous property values. Anyway, the reason I considered it is because it is the normal state of affairs for any dynamically typed language. The type is associated with each value rather than with the array, and this is something many people are used to working with. It's also how JSON arrays work. So actually enforcing that each value be of the same type may be more complicated than just allowing them to have different types.
That said, I do agree the use-case is rare, so I will leave both options open until we can evaluate them while implementing this feature.
That depends on how it is implemented. Most of the work is probably going to be in adjusting the Properties view to be able to work with arrays and allowing to add/remove elements. Maybe it can be done inline, or maybe it makes more sense to spawn a dialog for this. And all this work is not going to be much harder if any data is supported rather than just supporting strings.
So I'm not talking about adding just a "string array" type of property, but rather adding an "Array" checkbox separate of the type (or adding just an "array" property type, if values will be allowed to be heterogeneous).