Erasing array elements while iterating does not appear to be safe.
For example, the following prints nothing:
```
var a := [0,1,2,3,4,5,6]
for i in a:
if i % 2 == 0:
a.erase(i)
else:
print(i)
```
While this is often true for array implementations, it still seems worth
documenting explicitly. I copied the wording from Dictionary.xml.
This was somewhat implied by specifically calling out nested arrays and
dictionaries, but I was still unsure and had to test it myself.
One might expect that `Resource` objects, which have a `duplicate`
method, might be deep-copied.
- Removed empty paragraphs in XML.
- Consistently use bold style for "Example:", on a new line.
- Fix usage of `[code]` when hyperlinks could be used (`[member]`, `[constant]`).
- Fix invalid usage of backticks for inline code in BBCode.
- Fix some American/British English spelling inconsistencies.
- Other minor fixes spotted along the way, including typo fixes with codespell.
- Don't specify `@GlobalScope` for `enum` and `constant`.
The docs specify that Array.remove does nothing if the index does not
exist. Array.erase does not have a similar phrase, so it's unclear if
erase will print an error, or silently do nothing.
This makes it easier to spot syntax errors when editing the
class reference. The schema is referenced locally so validation
can still work offline.
Each class XML's schema conformance is also checked on GitHub Actions.
The documentation for the sort method warns the user that it doesn't do natural sort but fails to provide a solution when it's just a one liner thanks to String.naturalnocasecmp_to() and lambda support
This suggests exactly the same algorithm as used by the filesystem dock for file sorting.
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
The same is done for `Vector` (and thus `Packed*Array`).
`begin` and `end` can now take any value and will be clamped to
`[-size(), size()]`. Negative values are a shorthand for indexing the array
from the last element upward.
`end` is given a default `INT_MAX` value (which will be clamped to `size()`)
so that the `end` parameter can be omitted to go from `begin` to the max size
of the array.
This makes `slice` works similarly to numpy's and JavaScript's.
For the time being we don't support writing a description for those, preferring
having all details in the method's description.
Using self-closing tags saves half the lines, and prevents contributors from
thinking that they should write the argument or return documentation there.
This pull request fixes an assortment of typos and improves conciseness in `Animation`, `Area2D`, `Array`, `ArrayMesh`, `Control`, `Directory`, `EditorPlugin`, `Engine`, and `OS`.
Includes:
* Variant
* Viewport
and two fixes in Array that were pointed out in #40978
VisualScript classes are skipped on purpose.
That is the final commit of the inital code porting to C#. :)