Commit graph

117 commits

Author SHA1 Message Date
Max Hilbrunner
5cefc07d90
Merge pull request #67444 from nonunknown/array_pick_random
Add ability to pick random value from array
2022-10-21 16:25:52 +02:00
Nonunknown
9f4dbf415d add ability to pick random value from array 2022-10-20 08:39:47 -03:00
Max Hilbrunner
e6311c8e5e
Merge pull request #67001 from KoBeWi/🎲
Fill random docs
2022-10-19 21:58:03 +02:00
Hugo Locurcio
85b617a6a3
Document Array.sort() and sort_custom() using unstable sorting 2022-10-08 01:16:41 +02:00
kobewi
1b7aee3c8d Fill random docs 2022-10-07 20:10:18 +02:00
bruvzg
163257d51b
[GDExtension] Implement support for typed arrays. 2022-09-22 23:31:27 +03:00
Andy Maloney
c7da28165b [doc] Fix grammar in class docs: less vs. fewer/lower 2022-08-18 12:35:54 -04:00
Andy Maloney
9b345e793a [doc] Use "param" instead of "code" to refer to parameters (8) 2022-08-12 14:00:25 -04:00
Yuri Sizov
c5d7115038 Rename the argument tag to param in XML documentation 2022-08-08 22:34:31 +03:00
Danil Alexeev
8b97fa4dcd
Clarify all and any documentation for empty arrays 2022-06-16 20:50:31 +03:00
Hugo Locurcio
a98e31aa3a
Add any() and all() methods to Array
These can be used as faster, more convenient shorthands to
using `filter()` + `size()`.
2022-05-25 16:09:10 +02:00
Rémi Verschelde
c91f4ac419
Merge pull request #59910 from rcorre/array-remove-doc 2022-04-05 13:43:21 +02:00
Ryan Roden-Corrent
f84e2db35e
Clarify Array.erase for nonexistant element.
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.
2022-04-05 07:07:56 -04:00
Hugo Locurcio
de363db2a6
Improve documentation for Array operators 2022-03-30 20:04:45 +02:00
Karmavil
aef97305db Add descriptions to operators 2022-03-27 12:13:56 -03:00
Yuri Roubinsky
32f2c47356 Remove generating of null comparison operators from documentation 2022-03-14 22:35:23 +03:00
Hugo Locurcio
b68dd2e189
Add an XML schema for documentation
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.
2022-02-15 00:03:31 +01:00
Hugo Locurcio
08541fe11d
Clarify identical hash() return values due to collisions 2022-02-12 22:21:37 +01:00
Rémi Verschelde
9912492e93
Merge pull request #56668 from akien-mga/array-slice-nicer-bound-checks 2022-01-18 13:22:35 +01:00
Lisandro Lorea
176a9c738f
Give example of one-liner for Array natural sort
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>
2022-01-17 15:11:50 -03:00
Rémi Verschelde
c6cefb1b79
Array: Relax slice bound checks to properly handle negative indices
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.
2022-01-10 22:42:03 +01:00
Nathan Franke
dd30253cdc
PackedByteArray, Array slice end exclusive, rename subarray to slice 2021-11-26 22:13:12 -06:00
Lightning_A
e078f970db Rename remove() to remove_at() when removing by index 2021-11-23 18:58:57 -07:00
kobewi
f529a58f10 Improve sort_custom() example 2021-11-12 23:18:33 +01:00
Aaron Franke
6772ebcea0
Move the docs for constructors and operators out of methods section 2021-10-29 12:34:57 -05:00
Rémi Verschelde
788b3aa27a
doc: Fix style inconsistencies for [b]Note:[/b] paragraphs
And fix up formatting not supported by makerst.
2021-10-05 19:13:20 +02:00
Aaron Franke
d54f2ad7ca
Don't generate empty doc sections and reduce code duplication 2021-09-20 20:59:33 -05:00
George Marques
455e142d37
Allow comparing equality between builtin types and null 2021-09-17 12:33:52 -03:00
Max Hilbrunner
5b49c6bba4 Fix docs for Array's slice() 2021-09-07 21:40:21 +02:00
Johannes Witt
48a8a59ad7
Specify description of Array.slices end parameter 2021-09-05 21:49:57 +02:00
Max Hilbrunner
a2473d7ebe Fix Array class docs after #47406 2021-08-28 22:17:41 +02:00
Hugo Locurcio
60116b17b5
Add an Array.pop_at() method to pop an element at an arbitrary index
Negative indices are supported to pop an element relative from the end.
2021-08-27 00:51:17 +02:00
Rémi Verschelde
7adf4cc9b5
doc: Use self-closing tags for return and argument
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.
2021-07-30 15:29:52 +02:00
Nicholas Huelin
9a72b0d3d0 Fix doc typos
This pull request fixes an assortment of typos and improves conciseness in `Animation`, `Area2D`,  `Array`, `ArrayMesh`, `Control`, `Directory`, `EditorPlugin`, `Engine`, and `OS`.
2021-07-23 12:15:15 -04:00
Rémi Verschelde
74b3b0db0e
Merge pull request #47584 from HaSa1002/docs-lang-7 2021-06-11 14:35:45 +02:00
Johannes
23bc697239
Port code examples to C# (V)
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#. :)
2021-06-11 13:24:11 +02:00
kobewi
48f0368ddc Improve sort_custom() description 2021-06-03 17:43:39 +02:00
Rémi Verschelde
4219a4cb6f
Fix typos with codespell
Using codespell 2.0.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
GIRD
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2021-05-20 12:38:56 +02:00
kobewi
a95c953c48 Improve docs for filter map and reduce 2021-05-07 14:09:44 +02:00
Tomasz Chabora
c50acc7339 Add filter, map and reduce to Array 2021-05-05 15:54:57 +02:00
Matheus Lima Cunha
efd27a63c1 Add fill method to Arrays and PackedArrays 2021-04-21 11:33:53 -03:00
Yuri Sizov
c526a1e22d Fix misformatted documentation from #47435, #42827, #46991 2021-04-04 23:25:40 +03:00
Marcel Admiraal
755c70b871 Rename Array.invert() to Array.reverse()
Does the same internally for List and Vector<>, which includes all
PackedArray types.
2021-03-21 10:20:08 +00:00
Rémi Verschelde
4ca1e73ff9
doc: Sync classref with current source
And move GLTF docs to its module folder.
2021-03-18 16:37:43 +01:00
Haoyu Qiu
31243e377f Fixes typo in Array::bsearch_custom doc 2021-02-26 18:01:08 +08:00
kobewi
fb83d905da Change sort_custom/bsearch_custom to use Callables 2021-02-04 14:37:52 +01:00
Rémi Verschelde
34eb5638d3
Merge pull request #44624 from Calinou/doc-array-hash
Improve the `Array.hash()` documentation
2021-01-26 15:53:35 +01:00
Hugo Locurcio
7ce3cc0478
Document low performance of Array.push_front() and Array.pop_front() 2021-01-26 00:02:55 +01:00
Rémi Verschelde
215d18814e
doc: Sync classref with current source 2021-01-04 14:33:44 +01:00
Marcel Admiraal
5b937d493f Rename empty() to is_empty() 2020-12-28 10:39:56 +00:00