|
@@ -381,20 +381,22 @@
|
|
</description>
|
|
</description>
|
|
</method>
|
|
</method>
|
|
<method name="store_8">
|
|
<method name="store_8">
|
|
- <return type="void" />
|
|
|
|
|
|
+ <return type="bool" />
|
|
<param index="0" name="value" type="int" />
|
|
<param index="0" name="value" type="int" />
|
|
<description>
|
|
<description>
|
|
Stores an integer as 8 bits in the file.
|
|
Stores an integer as 8 bits in the file.
|
|
[b]Note:[/b] The [param value] should lie in the interval [code][0, 255][/code]. Any other value will overflow and wrap around.
|
|
[b]Note:[/b] The [param value] should lie in the interval [code][0, 255][/code]. Any other value will overflow and wrap around.
|
|
|
|
+ [b]Note:[/b] If an error occurs, the resulting value of the file position indicator is indeterminate.
|
|
To store a signed integer, use [method store_64], or convert it manually (see [method store_16] for an example).
|
|
To store a signed integer, use [method store_64], or convert it manually (see [method store_16] for an example).
|
|
</description>
|
|
</description>
|
|
</method>
|
|
</method>
|
|
<method name="store_16">
|
|
<method name="store_16">
|
|
- <return type="void" />
|
|
|
|
|
|
+ <return type="bool" />
|
|
<param index="0" name="value" type="int" />
|
|
<param index="0" name="value" type="int" />
|
|
<description>
|
|
<description>
|
|
Stores an integer as 16 bits in the file.
|
|
Stores an integer as 16 bits in the file.
|
|
[b]Note:[/b] The [param value] should lie in the interval [code][0, 2^16 - 1][/code]. Any other value will overflow and wrap around.
|
|
[b]Note:[/b] The [param value] should lie in the interval [code][0, 2^16 - 1][/code]. Any other value will overflow and wrap around.
|
|
|
|
+ [b]Note:[/b] If an error occurs, the resulting value of the file position indicator is indeterminate.
|
|
To store a signed integer, use [method store_64] or store a signed integer from the interval [code][-2^15, 2^15 - 1][/code] (i.e. keeping one bit for the signedness) and compute its sign manually when reading. For example:
|
|
To store a signed integer, use [method store_64] or store a signed integer from the interval [code][-2^15, 2^15 - 1][/code] (i.e. keeping one bit for the signedness) and compute its sign manually when reading. For example:
|
|
[codeblocks]
|
|
[codeblocks]
|
|
[gdscript]
|
|
[gdscript]
|
|
@@ -431,97 +433,108 @@
|
|
</description>
|
|
</description>
|
|
</method>
|
|
</method>
|
|
<method name="store_32">
|
|
<method name="store_32">
|
|
- <return type="void" />
|
|
|
|
|
|
+ <return type="bool" />
|
|
<param index="0" name="value" type="int" />
|
|
<param index="0" name="value" type="int" />
|
|
<description>
|
|
<description>
|
|
Stores an integer as 32 bits in the file.
|
|
Stores an integer as 32 bits in the file.
|
|
[b]Note:[/b] The [param value] should lie in the interval [code][0, 2^32 - 1][/code]. Any other value will overflow and wrap around.
|
|
[b]Note:[/b] The [param value] should lie in the interval [code][0, 2^32 - 1][/code]. Any other value will overflow and wrap around.
|
|
|
|
+ [b]Note:[/b] If an error occurs, the resulting value of the file position indicator is indeterminate.
|
|
To store a signed integer, use [method store_64], or convert it manually (see [method store_16] for an example).
|
|
To store a signed integer, use [method store_64], or convert it manually (see [method store_16] for an example).
|
|
</description>
|
|
</description>
|
|
</method>
|
|
</method>
|
|
<method name="store_64">
|
|
<method name="store_64">
|
|
- <return type="void" />
|
|
|
|
|
|
+ <return type="bool" />
|
|
<param index="0" name="value" type="int" />
|
|
<param index="0" name="value" type="int" />
|
|
<description>
|
|
<description>
|
|
Stores an integer as 64 bits in the file.
|
|
Stores an integer as 64 bits in the file.
|
|
[b]Note:[/b] The [param value] must lie in the interval [code][-2^63, 2^63 - 1][/code] (i.e. be a valid [int] value).
|
|
[b]Note:[/b] The [param value] must lie in the interval [code][-2^63, 2^63 - 1][/code] (i.e. be a valid [int] value).
|
|
|
|
+ [b]Note:[/b] If an error occurs, the resulting value of the file position indicator is indeterminate.
|
|
</description>
|
|
</description>
|
|
</method>
|
|
</method>
|
|
<method name="store_buffer">
|
|
<method name="store_buffer">
|
|
- <return type="void" />
|
|
|
|
|
|
+ <return type="bool" />
|
|
<param index="0" name="buffer" type="PackedByteArray" />
|
|
<param index="0" name="buffer" type="PackedByteArray" />
|
|
<description>
|
|
<description>
|
|
Stores the given array of bytes in the file.
|
|
Stores the given array of bytes in the file.
|
|
|
|
+ [b]Note:[/b] If an error occurs, the resulting value of the file position indicator is indeterminate.
|
|
</description>
|
|
</description>
|
|
</method>
|
|
</method>
|
|
<method name="store_csv_line">
|
|
<method name="store_csv_line">
|
|
- <return type="void" />
|
|
|
|
|
|
+ <return type="bool" />
|
|
<param index="0" name="values" type="PackedStringArray" />
|
|
<param index="0" name="values" type="PackedStringArray" />
|
|
<param index="1" name="delim" type="String" default="","" />
|
|
<param index="1" name="delim" type="String" default="","" />
|
|
<description>
|
|
<description>
|
|
Store the given [PackedStringArray] in the file as a line formatted in the CSV (Comma-Separated Values) format. You can pass a different delimiter [param delim] to use other than the default [code]","[/code] (comma). This delimiter must be one-character long.
|
|
Store the given [PackedStringArray] in the file as a line formatted in the CSV (Comma-Separated Values) format. You can pass a different delimiter [param delim] to use other than the default [code]","[/code] (comma). This delimiter must be one-character long.
|
|
Text will be encoded as UTF-8.
|
|
Text will be encoded as UTF-8.
|
|
|
|
+ [b]Note:[/b] If an error occurs, the resulting value of the file position indicator is indeterminate.
|
|
</description>
|
|
</description>
|
|
</method>
|
|
</method>
|
|
<method name="store_double">
|
|
<method name="store_double">
|
|
- <return type="void" />
|
|
|
|
|
|
+ <return type="bool" />
|
|
<param index="0" name="value" type="float" />
|
|
<param index="0" name="value" type="float" />
|
|
<description>
|
|
<description>
|
|
Stores a floating-point number as 64 bits in the file.
|
|
Stores a floating-point number as 64 bits in the file.
|
|
|
|
+ [b]Note:[/b] If an error occurs, the resulting value of the file position indicator is indeterminate.
|
|
</description>
|
|
</description>
|
|
</method>
|
|
</method>
|
|
<method name="store_float">
|
|
<method name="store_float">
|
|
- <return type="void" />
|
|
|
|
|
|
+ <return type="bool" />
|
|
<param index="0" name="value" type="float" />
|
|
<param index="0" name="value" type="float" />
|
|
<description>
|
|
<description>
|
|
Stores a floating-point number as 32 bits in the file.
|
|
Stores a floating-point number as 32 bits in the file.
|
|
|
|
+ [b]Note:[/b] If an error occurs, the resulting value of the file position indicator is indeterminate.
|
|
</description>
|
|
</description>
|
|
</method>
|
|
</method>
|
|
<method name="store_half">
|
|
<method name="store_half">
|
|
- <return type="void" />
|
|
|
|
|
|
+ <return type="bool" />
|
|
<param index="0" name="value" type="float" />
|
|
<param index="0" name="value" type="float" />
|
|
<description>
|
|
<description>
|
|
Stores a half-precision floating-point number as 16 bits in the file.
|
|
Stores a half-precision floating-point number as 16 bits in the file.
|
|
</description>
|
|
</description>
|
|
</method>
|
|
</method>
|
|
<method name="store_line">
|
|
<method name="store_line">
|
|
- <return type="void" />
|
|
|
|
|
|
+ <return type="bool" />
|
|
<param index="0" name="line" type="String" />
|
|
<param index="0" name="line" type="String" />
|
|
<description>
|
|
<description>
|
|
Stores [param line] in the file followed by a newline character ([code]\n[/code]), encoding the text as UTF-8.
|
|
Stores [param line] in the file followed by a newline character ([code]\n[/code]), encoding the text as UTF-8.
|
|
|
|
+ [b]Note:[/b] If an error occurs, the resulting value of the file position indicator is indeterminate.
|
|
</description>
|
|
</description>
|
|
</method>
|
|
</method>
|
|
<method name="store_pascal_string">
|
|
<method name="store_pascal_string">
|
|
- <return type="void" />
|
|
|
|
|
|
+ <return type="bool" />
|
|
<param index="0" name="string" type="String" />
|
|
<param index="0" name="string" type="String" />
|
|
<description>
|
|
<description>
|
|
Stores the given [String] as a line in the file in Pascal format (i.e. also store the length of the string).
|
|
Stores the given [String] as a line in the file in Pascal format (i.e. also store the length of the string).
|
|
Text will be encoded as UTF-8.
|
|
Text will be encoded as UTF-8.
|
|
|
|
+ [b]Note:[/b] If an error occurs, the resulting value of the file position indicator is indeterminate.
|
|
</description>
|
|
</description>
|
|
</method>
|
|
</method>
|
|
<method name="store_real">
|
|
<method name="store_real">
|
|
- <return type="void" />
|
|
|
|
|
|
+ <return type="bool" />
|
|
<param index="0" name="value" type="float" />
|
|
<param index="0" name="value" type="float" />
|
|
<description>
|
|
<description>
|
|
Stores a floating-point number in the file.
|
|
Stores a floating-point number in the file.
|
|
|
|
+ [b]Note:[/b] If an error occurs, the resulting value of the file position indicator is indeterminate.
|
|
</description>
|
|
</description>
|
|
</method>
|
|
</method>
|
|
<method name="store_string">
|
|
<method name="store_string">
|
|
- <return type="void" />
|
|
|
|
|
|
+ <return type="bool" />
|
|
<param index="0" name="string" type="String" />
|
|
<param index="0" name="string" type="String" />
|
|
<description>
|
|
<description>
|
|
Stores [param string] in the file without a newline character ([code]\n[/code]), encoding the text as UTF-8.
|
|
Stores [param string] in the file without a newline character ([code]\n[/code]), encoding the text as UTF-8.
|
|
[b]Note:[/b] This method is intended to be used to write text files. The string is stored as a UTF-8 encoded buffer without string length or terminating zero, which means that it can't be loaded back easily. If you want to store a retrievable string in a binary file, consider using [method store_pascal_string] instead. For retrieving strings from a text file, you can use [code]get_buffer(length).get_string_from_utf8()[/code] (if you know the length) or [method get_as_text].
|
|
[b]Note:[/b] This method is intended to be used to write text files. The string is stored as a UTF-8 encoded buffer without string length or terminating zero, which means that it can't be loaded back easily. If you want to store a retrievable string in a binary file, consider using [method store_pascal_string] instead. For retrieving strings from a text file, you can use [code]get_buffer(length).get_string_from_utf8()[/code] (if you know the length) or [method get_as_text].
|
|
|
|
+ [b]Note:[/b] If an error occurs, the resulting value of the file position indicator is indeterminate.
|
|
</description>
|
|
</description>
|
|
</method>
|
|
</method>
|
|
<method name="store_var">
|
|
<method name="store_var">
|
|
- <return type="void" />
|
|
|
|
|
|
+ <return type="bool" />
|
|
<param index="0" name="value" type="Variant" />
|
|
<param index="0" name="value" type="Variant" />
|
|
<param index="1" name="full_objects" type="bool" default="false" />
|
|
<param index="1" name="full_objects" type="bool" default="false" />
|
|
<description>
|
|
<description>
|
|
Stores any Variant value in the file. If [param full_objects] is [code]true[/code], encoding objects is allowed (and can potentially include code).
|
|
Stores any Variant value in the file. If [param full_objects] is [code]true[/code], encoding objects is allowed (and can potentially include code).
|
|
Internally, this uses the same encoding mechanism as the [method @GlobalScope.var_to_bytes] method.
|
|
Internally, this uses the same encoding mechanism as the [method @GlobalScope.var_to_bytes] method.
|
|
[b]Note:[/b] Not all properties are included. Only properties that are configured with the [constant PROPERTY_USAGE_STORAGE] flag set will be serialized. You can add a new usage flag to a property by overriding the [method Object._get_property_list] method in your class. You can also check how property usage is configured by calling [method Object._get_property_list]. See [enum PropertyUsageFlags] for the possible usage flags.
|
|
[b]Note:[/b] Not all properties are included. Only properties that are configured with the [constant PROPERTY_USAGE_STORAGE] flag set will be serialized. You can add a new usage flag to a property by overriding the [method Object._get_property_list] method in your class. You can also check how property usage is configured by calling [method Object._get_property_list]. See [enum PropertyUsageFlags] for the possible usage flags.
|
|
|
|
+ [b]Note:[/b] If an error occurs, the resulting value of the file position indicator is indeterminate.
|
|
</description>
|
|
</description>
|
|
</method>
|
|
</method>
|
|
</methods>
|
|
</methods>
|