mirror of
https://github.com/stan220/godot-docs.git
synced 2026-09-08 18:29:11 +00:00
Use literal blocks for code samples with GDScript.
GDScript is already the default, it's redundant to specify it explicitly. A [literal block][1] is already enough. [1]: https://www.sphinx-doc.org/en/1.8/usage/restructuredtext/basics.html#rst-literal-blocks
This commit is contained in:
@@ -481,7 +481,7 @@ Summing it up
|
||||
|
||||
Here is the GDScript sample code:
|
||||
|
||||
.. code::
|
||||
::
|
||||
|
||||
extends Node
|
||||
|
||||
|
||||
@@ -265,7 +265,7 @@ Loading it on GDScript
|
||||
]
|
||||
}
|
||||
|
||||
.. code::
|
||||
::
|
||||
|
||||
extends Node
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ Using C# from GDScript doesn't need much work. Once loaded
|
||||
(see :ref:`doc_gdscript_classes_as_resources`) the script can be instantiated
|
||||
with :ref:`new() <class_CSharpScript_method_new>`.
|
||||
|
||||
.. code-block:: gdscript
|
||||
::
|
||||
|
||||
var my_csharp_script = load("res://path_to_cs_file.cs")
|
||||
var my_csharp_node = my_csharp_script.new()
|
||||
@@ -116,7 +116,7 @@ Accessing C# fields from GDScript
|
||||
Accessing C# fields from GDScript is straightforward, you shouldn't have
|
||||
anything to worry about.
|
||||
|
||||
.. code-block:: gdscript
|
||||
::
|
||||
|
||||
print(my_csharp_node.str1) # bar
|
||||
my_csharp_node.str1 = "BAR"
|
||||
@@ -160,7 +160,7 @@ marshalling process will do its best to cast your the arguments to match
|
||||
function signatures.
|
||||
If that's impossible you'll see the following error: ``Invalid call. Nonexistent function `FunctionName```.
|
||||
|
||||
.. code-block:: gdscript
|
||||
::
|
||||
|
||||
my_csharp_node.PrintNodeName(self) # myGDScriptNode
|
||||
# my_csharp_node.PrintNodeName() # This line will fail.
|
||||
|
||||
@@ -264,7 +264,7 @@ The module should include the full Java path. For our example: ``org/godotengine
|
||||
|
||||
Then, from your script:
|
||||
|
||||
.. code::
|
||||
::
|
||||
|
||||
if Engine.has_singleton("MySingleton"):
|
||||
var singleton = Engine.get_singleton("MySingleton")
|
||||
|
||||
Reference in New Issue
Block a user