Commit Graph

99 Commits

Author SHA1 Message Date
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
Hugo Locurcio 435848192e
Improve the `Array.hash()` documentation
Co-authored-by: Laguzus <67963093+Laguzus@users.noreply.github.com>
2020-12-23 19:13:10 +01:00
Hugo Locurcio 5325de4e6b
Improve the Dictionary class documentation
- Mention Lua-style syntax.
- Make the code samples self-contained.
- Mention caveat with `const` (also in Array).
- Clarify the description of `size()`.

This closes https://github.com/godotengine/godot-docs/issues/4272.
2020-11-14 22:05:53 +01:00
Rémi Verschelde 9397a5a272
Merge pull request #43437 from akien-mga/doc-operators
doc: Add template to document Variant operators, fixups to #43419
2020-11-10 15:58:36 +01:00
Rémi Verschelde 64e893deac
doc: Sync classref to add operators after #43419 2020-11-10 15:00:50 +01:00
Rémi Verschelde 03ae26bb74
Merge pull request #43398 from KoBeWi/add_an_array_to_another_array_but_with_a_method
Add append_array() method to Array class
2020-11-10 13:53:58 +01:00
Rémi Verschelde 0f249f5c0a
Variant: Sync docs with new constructors, fixups after #43403
Change DocData comparators for MethodDoc and ArgumentDoc to get a better
ordering of constructors.
2020-11-09 23:39:53 +01:00
Tomasz Chabora 9f23a94b8a Add append_array() method to Array class 2020-11-08 21:09:45 +01:00
Rémi Verschelde 424cd00f8b
doc: Sync classref with current source + fixup some bindings
Includes various changes triggered by the refactoring of method bindings.
2020-11-04 15:38:26 +01:00
HaSa1002 c5aded55df Add C# code examples to the docs
Only existing GDScript code examples are converted and added to the
docs.
This is the first batch include classes beginning with A and B.

Included classes:
 * AcceptDialog
 * AESContext
 * Animation
 * AnimationNodeStateMachine
 * AnimationNodeStateMachinePlayback
 * AnimationNodeStateMachineTransition
 * Array
 * ArrayMesh
 * AStar
 * AStar2D
 * Bool
 * Button
2020-09-26 12:29:55 +02:00
Hugo Locurcio 603eddce86
Fix a typo in the Array class documentation
This closes https://github.com/godotengine/godot-docs/issues/4049.
2020-09-21 17:03:14 +02:00
Hugo Locurcio 263f620421
Improve documentation related to Array error handling
This closes https://github.com/godotengine/godot-docs/issues/3834.
2020-09-09 14:57:02 +02:00
Tomasz Chabora 4ff1a34171 Mention that Array.front/back throw error if empty 2020-08-12 17:53:18 +02:00
Aaron Franke 9986439352
Commit other files changed by file_format.sh 2020-07-13 14:14:11 -04:00
Hugo Locurcio 7f01f68226
Document the `in` operator in String, Array and Dictionary classes
This also clarifies the `in` operator behavior in Object.
2020-06-12 19:22:35 +02:00
Hugo Locurcio 675fea1648
Document that Dictionary is always passed as reference
See #38792.
2020-05-16 23:52:40 +02:00
Rémi Verschelde a2d3ba3372 doc: Sync classref with current source
Fix wrong binding after #37111.
2020-03-18 09:14:57 +01:00
Rémi Verschelde 788765709d DocData: Fix serialization of Variant default values
Co-authored-by: Bojidar Marinov <bojidar.marinov.bg@gmail.com>
2020-03-09 10:52:44 +01:00
Hugo Locurcio 8d53562954
doc: Mention concatenation using the `+` operator in Array
This closes https://github.com/godotengine/godot-docs/issues/2452.
2020-02-27 23:34:16 +01:00