mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Replace XML codeblock spaces with tabs
This commit is contained in:
@@ -87,13 +87,13 @@
|
||||
Returns an array of dictionaries representing the current call stack. See also [method print_stack].
|
||||
[codeblock]
|
||||
func _ready():
|
||||
foo()
|
||||
foo()
|
||||
|
||||
func foo():
|
||||
bar()
|
||||
bar()
|
||||
|
||||
func bar():
|
||||
print(get_stack())
|
||||
print(get_stack())
|
||||
[/codeblock]
|
||||
Starting from [code]_ready()[/code], [code]bar()[/code] would print:
|
||||
[codeblock lang=text]
|
||||
@@ -111,9 +111,9 @@
|
||||
[codeblock]
|
||||
var foo = "bar"
|
||||
func _ready():
|
||||
var d = inst_to_dict(self)
|
||||
print(d.keys())
|
||||
print(d.values())
|
||||
var d = inst_to_dict(self)
|
||||
print(d.keys())
|
||||
print(d.values())
|
||||
[/codeblock]
|
||||
Prints out:
|
||||
[codeblock lang=text]
|
||||
@@ -232,7 +232,7 @@
|
||||
[codeblock]
|
||||
var array = [3, 6, 9]
|
||||
for i in range(array.size() - 1, -1, -1):
|
||||
print(array[i])
|
||||
print(array[i])
|
||||
[/codeblock]
|
||||
Output:
|
||||
[codeblock lang=text]
|
||||
@@ -243,7 +243,7 @@
|
||||
To iterate over [float], convert them in the loop.
|
||||
[codeblock]
|
||||
for i in range (3, 0, -1):
|
||||
print(i / 10.0)
|
||||
print(i / 10.0)
|
||||
[/codeblock]
|
||||
Output:
|
||||
[codeblock lang=text]
|
||||
@@ -701,14 +701,14 @@
|
||||
var randomize_color_action = randomize_color
|
||||
|
||||
func hello():
|
||||
print("Hello world!")
|
||||
print("Hello world!")
|
||||
|
||||
func randomize_color():
|
||||
var undo_redo = EditorInterface.get_editor_undo_redo()
|
||||
undo_redo.create_action("Randomized Sprite2D Color")
|
||||
undo_redo.add_do_property(self, &"self_modulate", Color(randf(), randf(), randf()))
|
||||
undo_redo.add_undo_property(self, &"self_modulate", self_modulate)
|
||||
undo_redo.commit_action()
|
||||
var undo_redo = EditorInterface.get_editor_undo_redo()
|
||||
undo_redo.create_action("Randomized Sprite2D Color")
|
||||
undo_redo.add_do_property(self, &"self_modulate", Color(randf(), randf(), randf()))
|
||||
undo_redo.add_undo_property(self, &"self_modulate", self_modulate)
|
||||
undo_redo.commit_action()
|
||||
[/codeblock]
|
||||
[b]Note:[/b] The property is exported without the [constant PROPERTY_USAGE_STORAGE] flag because a [Callable] cannot be properly serialized and stored in a file.
|
||||
[b]Note:[/b] In an exported project neither [EditorInterface] nor [EditorUndoRedoManager] exist, which may cause some scripts to break. To prevent this, you can use [method Engine.get_singleton] and omit the static type from the variable declaration:
|
||||
@@ -791,10 +791,10 @@
|
||||
Mark the following statement to ignore the specified [param warning]. See [url=$DOCS_URL/tutorials/scripting/gdscript/warning_system.html]GDScript warning system[/url].
|
||||
[codeblock]
|
||||
func test():
|
||||
print("hello")
|
||||
return
|
||||
@warning_ignore("unreachable_code")
|
||||
print("unreachable")
|
||||
print("hello")
|
||||
return
|
||||
@warning_ignore("unreachable_code")
|
||||
print("unreachable")
|
||||
[/codeblock]
|
||||
See also [annotation @warning_ignore_start] and [annotation @warning_ignore_restore].
|
||||
</description>
|
||||
@@ -814,12 +814,12 @@
|
||||
Starts ignoring the listed warning types until the end of the file or the [annotation @warning_ignore_restore] annotation with the given warning type.
|
||||
[codeblock]
|
||||
func test():
|
||||
var a = 1 # Warning (if enabled in the Project Settings).
|
||||
@warning_ignore_start("unused_variable")
|
||||
var b = 2 # No warning.
|
||||
var c = 3 # No warning.
|
||||
@warning_ignore_restore("unused_variable")
|
||||
var d = 4 # Warning (if enabled in the Project Settings).
|
||||
var a = 1 # Warning (if enabled in the Project Settings).
|
||||
@warning_ignore_start("unused_variable")
|
||||
var b = 2 # No warning.
|
||||
var c = 3 # No warning.
|
||||
@warning_ignore_restore("unused_variable")
|
||||
var d = 4 # Warning (if enabled in the Project Settings).
|
||||
[/codeblock]
|
||||
[b]Note:[/b] To suppress a single warning, use [annotation @warning_ignore] instead.
|
||||
[b]Note:[/b] Unlike most other annotations, arguments of the [annotation @warning_ignore_start] annotation must be string literals (constant expressions are not supported).
|
||||
|
||||
Reference in New Issue
Block a user