feat: updated engine version to 4.4-rc1

This commit is contained in:
Sara 2025-02-23 14:38:14 +01:00
parent ee00efde1f
commit 21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions

View file

@ -6,8 +6,7 @@
<description>
The [JSON] class enables all data types to be converted to and from a JSON string. This is useful for serializing data, e.g. to save to a file or send over the network.
[method stringify] is used to convert any data type into a JSON string.
[method parse] is used to convert any existing JSON data into a [Variant] that can be used within Godot. If successfully parsed, use [member data] to retrieve the [Variant], and use [code]typeof[/code] to check if the Variant's type is what you expect. JSON Objects are converted into a [Dictionary], but JSON data can be used to store [Array]s, numbers, [String]s and even just a boolean.
[b]Example[/b]
[method parse] is used to convert any existing JSON data into a [Variant] that can be used within Godot. If successfully parsed, use [member data] to retrieve the [Variant], and use [method @GlobalScope.typeof] to check if the Variant's type is what you expect. JSON Objects are converted into a [Dictionary], but JSON data can be used to store [Array]s, numbers, [String]s and even just a boolean.
[codeblock]
var data_to_send = ["a", "b", "c"]
var json_string = JSON.stringify(data_to_send)
@ -19,7 +18,7 @@
if error == OK:
var data_received = json.data
if typeof(data_received) == TYPE_ARRAY:
print(data_received) # Prints array
print(data_received) # Prints the array.
else:
print("Unexpected data")
else:
@ -33,11 +32,25 @@
- Trailing commas in arrays or objects are ignored, instead of causing a parser error.
- New line and tab characters are accepted in string literals, and are treated like their corresponding escape sequences [code]\n[/code] and [code]\t[/code].
- Numbers are parsed using [method String.to_float] which is generally more lax than the JSON specification.
- Certain errors, such as invalid Unicode sequences, do not cause a parser error. Instead, the string is cleansed and an error is logged to the console.
- Certain errors, such as invalid Unicode sequences, do not cause a parser error. Instead, the string is cleaned up and an error is logged to the console.
</description>
<tutorials>
</tutorials>
<methods>
<method name="from_native" qualifiers="static">
<return type="Variant" />
<param index="0" name="variant" type="Variant" />
<param index="1" name="full_objects" type="bool" default="false" />
<description>
Converts a native engine type to a JSON-compliant value.
By default, objects are ignored for security reasons, unless [param full_objects] is [code]true[/code].
You can convert a native value to a JSON string like this:
[codeblock]
func encode_data(value, full_objects = false):
return JSON.stringify(JSON.from_native(value, full_objects))
[/codeblock]
</description>
</method>
<method name="get_error_line" qualifiers="const">
<return type="int" />
<description>
@ -124,6 +137,20 @@
[/codeblock]
</description>
</method>
<method name="to_native" qualifiers="static">
<return type="Variant" />
<param index="0" name="json" type="Variant" />
<param index="1" name="allow_objects" type="bool" default="false" />
<description>
Converts a JSON-compliant value that was created with [method from_native] back to native engine types.
By default, objects are ignored for security reasons, unless [param allow_objects] is [code]true[/code].
You can convert a JSON string back to a native value like this:
[codeblock]
func decode_data(string, allow_objects = false):
return JSON.to_native(JSON.parse_string(string), allow_objects)
[/codeblock]
</description>
</method>
</methods>
<members>
<member name="data" type="Variant" setter="set_data" getter="get_data" default="null">