mirror of
https://github.com/godotengine/godot.git
synced 2024-11-27 09:16:35 +08:00
Merge pull request #35483 from YeldhamDev/doc_comment_spaces_removal
Remove unnecessary extra spaces before comments in code examples.
This commit is contained in:
commit
c66144738b
@ -8,11 +8,11 @@
|
||||
[b]Example:[/b]
|
||||
[codeblock]
|
||||
var array = ["One", 2, 3, "Four"]
|
||||
print(array[0]) # One
|
||||
print(array[2]) # 3
|
||||
print(array[-1]) # Four
|
||||
print(array[0]) # One.
|
||||
print(array[2]) # 3.
|
||||
print(array[-1]) # Four.
|
||||
array[2] = "Three"
|
||||
print(array[-2]) # Three
|
||||
print(array[-2]) # Three.
|
||||
[/codeblock]
|
||||
Arrays are always passed by reference.
|
||||
</description>
|
||||
@ -342,7 +342,7 @@
|
||||
|
||||
var my_items = [[5, "Potato"], [9, "Rice"], [4, "Tomato"]]
|
||||
my_items.sort_custom(MyCustomSorter, "sort_ascending")
|
||||
print(my_items) # Prints [[4, Tomato], [5, Potato], [9, Rice]]
|
||||
print(my_items) # Prints [[4, Tomato], [5, Potato], [9, Rice]].
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
|
@ -18,11 +18,11 @@
|
||||
<description>
|
||||
Constructs a color from an HTML hexadecimal color string in ARGB or RGB format. See also [method @GDScript.ColorN].
|
||||
[codeblock]
|
||||
# Each of the following creates the same color RGBA(178, 217, 10, 255)
|
||||
var c1 = Color("#ffb2d90a") # ARGB format with "#"
|
||||
var c2 = Color("ffb2d90a") # ARGB format
|
||||
var c3 = Color("#b2d90a") # RGB format with "#"
|
||||
var c4 = Color("b2d90a") # RGB format
|
||||
# Each of the following creates the same color RGBA(178, 217, 10, 255).
|
||||
var c1 = Color("#ffb2d90a") # ARGB format with "#".
|
||||
var c2 = Color("ffb2d90a") # ARGB format.
|
||||
var c3 = Color("#b2d90a") # RGB format with "#".
|
||||
var c4 = Color("b2d90a") # RGB format.
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
|
@ -32,7 +32,7 @@
|
||||
To add a key to an existing dictionary, access it like an existing key and assign to it:
|
||||
[codeblock]
|
||||
var points_dir = {"White": 50, "Yellow": 75, "Orange": 100}
|
||||
var points_dir["Blue"] = 150 # Add "Blue" as a key and assign 150 as its value.
|
||||
var points_dir["Blue"] = 150 # Add "Blue" as a key and assign 150 as its value.
|
||||
[/codeblock]
|
||||
Finally, dictionaries can contain different types of keys and values in the same dictionary:
|
||||
[codeblock]
|
||||
|
@ -78,9 +78,9 @@
|
||||
Selects characters inside [LineEdit] between [code]from[/code] and [code]to[/code]. By default, [code]from[/code] is at the beginning and [code]to[/code] at the end.
|
||||
[codeblock]
|
||||
text = "Welcome"
|
||||
select() # Will select "Welcome"
|
||||
select(4) # Will select "ome"
|
||||
select(2, 5) # Will select "lco"
|
||||
select() # Will select "Welcome".
|
||||
select(4) # Will select "ome".
|
||||
select(2, 5) # Will select "lco".
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
|
@ -12,8 +12,8 @@
|
||||
Property membership can be tested directly in GDScript using [code]in[/code]:
|
||||
[codeblock]
|
||||
var n = Node2D.new()
|
||||
print("position" in n) # Prints "True".
|
||||
print("other_property" in n) # Prints "False".
|
||||
print("position" in n) # Prints "True".
|
||||
print("other_property" in n) # Prints "False".
|
||||
[/codeblock]
|
||||
Objects also receive notifications. Notifications are a simple way to notify the object about different events, so they can all be handled together. See [method _notification].
|
||||
</description>
|
||||
|
@ -315,7 +315,7 @@
|
||||
[codeblock]
|
||||
var result = search(key, flags, line, column)
|
||||
if result.size() > 0:
|
||||
# result found
|
||||
# Result found.
|
||||
var res_line = result[TextEdit.SEARCH_RESULT_LINE]
|
||||
var res_column = result[TextEdit.SEARCH_RESULT_COLUMN]
|
||||
[/codeblock]
|
||||
|
@ -8,16 +8,16 @@
|
||||
It can take values in the interval [code][-2^63, 2^63 - 1][/code], i.e. [code][-9223372036854775808, 9223372036854775807][/code]. Exceeding those bounds will wrap around.
|
||||
[int] is a [Variant] type, and will thus be used when assigning an integer value to a [Variant]. It can also be enforced with the [code]: int[/code] type hint.
|
||||
[codeblock]
|
||||
var my_variant = 0 # int, value 0
|
||||
my_variant += 4.2 # float, value 4.2
|
||||
var my_int: int = 1 # int, value 1
|
||||
my_int = 4.2 # int, value 4, the right value is implicitly cast to int
|
||||
my_int = int("6.7") # int, value 6, the String is explicitly cast with [method int]
|
||||
var my_variant = 0 # int, value 0.
|
||||
my_variant += 4.2 # float, value 4.2.
|
||||
var my_int: int = 1 # int, value 1.
|
||||
my_int = 4.2 # int, value 4, the right value is implicitly cast to int.
|
||||
my_int = int("6.7") # int, value 6, the String is explicitly cast with int.
|
||||
|
||||
var max_int = 9223372036854775807
|
||||
print(max_int) # 9223372036854775807, OK
|
||||
print(max_int) # 9223372036854775807, OK.
|
||||
max_int += 1
|
||||
print(max_int) # -9223372036854775808, we overflowed and wrapped around
|
||||
print(max_int) # -9223372036854775808, we overflowed and wrapped around.
|
||||
[/codeblock]
|
||||
</description>
|
||||
<tutorials>
|
||||
|
Loading…
Reference in New Issue
Block a user