Let me rephrase;
MaxAstro wrote:Is there a way to make an array of objects?
Of course there is. You already did it in your first post.
I guess I'm confused as to why what I was trying to do wouldn't work, then? Other than ControlGetText not accepting an expression, of course...
Are you implying that it doesn't
work, or that you thought I was indicating it wouldn't work? I wasn't. There is nothing in your first post to indicate there was any problem other than ControlGetText requiring a variable. You even said that you had it working with a temporary variable (HoldingVar).
creates a new object derived from Varlist
, but it does not copy
the values from Varlist
initially is not defined, so it returns the default value defined in Varlist
. MyArray[A_Index].myVar1 := HoldingVar
stores the value in the derived object, MyArray[A_Index]
. So as I said, each of the 16 objects contain nothing other than a reference to Varlist
(initially), but there's nothing wrong with that
. I mentioned it because it can be important to understand how this works; for instance, modifying Varlist
will affect all instances, except those which have their own values defined.
guest3456 wrote:He was just being pedantic and correcting your misuse of the term 'variable' in your OP when you should have used the word 'key'.
I'm being pedantic:
I was not "just being pedantic" about the term "variable". To be pedantic is to be excessively
concerned with minor details. In this case, making a distinction between "variable" and "array element" is not excessive nor a minor detail; it is the fundamental reason that MaxAstro's original code and any other attempt to pass an array element will not work. ControlGetText requires a variable, and this is not a variable.
My "(Actually ..." comment was perhaps more detail than necessary, and apparently only served to confuse the OP.