Open gnysek opened 1 year ago
Ohh I wish I had this when I learned to use GML
This is by far the most friendly feature request i've seen yet. Thanks for keeping in mind the people learning GM for the first time. This was the hardest part of learning GM. (still confused by this to this today if im tired enough)
Is your feature request related to a problem?
I would like to improve
Variable Index [X] out of range [X]
as it might be confusing, especially if issue is that we're trying to address array index which is larger than array size by 1, like:Variable Index [10] out of range [10]
But most confusing message is:Variable Index [0] out of range [0]
when array is empty.All of them doesn't indicate that we were trying to index over size of table, as they are showing array size, in a notation which reminds array index.
Describe the solution you'd like
For arrays with more than 0 elements:
Variable Index [X] out of range [Y]
=>Variable Index [X] out of range; only indexes [0-Z] are allowed
_(where Z =array_length()-1
)_Examples:
Variable Index [10] out of range; only indexes [0-9] are allowed
Variable Index [120] out of range; only indexes [0-15] are allowed
Variable Index [1] out of range; only indexes [0-0] are allowed
For empty array:
Variable Index [X] out of range [0]
=>Variable Index [X] out of range; array is empty
Examples:
Variable Index [0] out of range; array is empty
Variable Index [120] out of range; array is empty
Describe alternatives you've considered
Removing square brackets around "out of range [Y"]` is another option. Another option is to use "out of range. Array have only Y elements".
Additional context
No response