Add type_string() utility

This commit is contained in:
Jakub Janšta
2023-09-25 20:33:43 +02:00
parent 57a6813bb8
commit 74c937079c
4 changed files with 22 additions and 83 deletions

View File

@@ -1403,6 +1403,19 @@
[/codeblock]
</description>
</method>
<method name="type_string">
<return type="String" />
<param index="0" name="type" type="int" />
<description>
Returns a human-readable name of the given [param type], using the [enum Variant.Type] values.
[codeblock]
print(TYPE_INT) # Prints 2.
print(type_string(TYPE_INT)) # Prints "int".
print(type_string(TYPE_STRING)) # Prints "String".
[/codeblock]
See also [method typeof].
</description>
</method>
<method name="typeof">
<return type="int" />
<param index="0" name="variable" type="Variant" />
@@ -1417,6 +1430,7 @@
else:
print("Unexpected result")
[/codeblock]
See also [method type_string].
</description>
</method>
<method name="var_to_bytes">