Merge pull request #34360 from timothyqiu/gdscript-func-docs
Updates docs for GDScript built-in functions
This commit is contained in:
commit
e9474715c0
2 changed files with 13 additions and 4 deletions
|
@ -168,14 +168,16 @@
|
||||||
<method name="char">
|
<method name="char">
|
||||||
<return type="String">
|
<return type="String">
|
||||||
</return>
|
</return>
|
||||||
<argument index="0" name="ascii" type="int">
|
<argument index="0" name="code" type="int">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Returns a character as a String of the given ASCII code.
|
Returns a character as a String of the given Unicode code point (which is compatible with ASCII code).
|
||||||
[codeblock]
|
[codeblock]
|
||||||
a = char(65) # a is "A"
|
a = char(65) # a is "A"
|
||||||
a = char(65 + 32) # a is "a"
|
a = char(65 + 32) # a is "a"
|
||||||
|
a = char(8364) # a is "€"
|
||||||
[/codeblock]
|
[/codeblock]
|
||||||
|
This is the inverse of [method ord].
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="clamp">
|
<method name="clamp">
|
||||||
|
@ -702,6 +704,13 @@
|
||||||
<argument index="0" name="char" type="String">
|
<argument index="0" name="char" type="String">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
|
Returns an integer representing the Unicode code point of the given Unicode character [code]char[/code].
|
||||||
|
[codeblock]
|
||||||
|
a = ord("A") # a is 65
|
||||||
|
a = ord("a") # a is 97
|
||||||
|
a = ord("€") # a is 8364
|
||||||
|
[/codeblock]
|
||||||
|
This is the inverse of [method char].
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="parse_json">
|
<method name="parse_json">
|
||||||
|
@ -937,7 +946,7 @@
|
||||||
<return type="int">
|
<return type="int">
|
||||||
</return>
|
</return>
|
||||||
<description>
|
<description>
|
||||||
Returns a random unsigned 32 bit integer. Use remainder to obtain a random value in the interval [code][0, N][/code] (where N is smaller than 2^32 -1).
|
Returns a random unsigned 32 bit integer. Use remainder to obtain a random value in the interval [code][0, N - 1][/code] (where N is smaller than 2^32).
|
||||||
[codeblock]
|
[codeblock]
|
||||||
randi() # Returns random integer between 0 and 2^32 - 1
|
randi() # Returns random integer between 0 and 2^32 - 1
|
||||||
randi() % 20 # Returns random integer between 0 and 19
|
randi() % 20 # Returns random integer between 0 and 19
|
||||||
|
|
|
@ -1855,7 +1855,7 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) {
|
||||||
} break;
|
} break;
|
||||||
case TEXT_CHAR: {
|
case TEXT_CHAR: {
|
||||||
|
|
||||||
MethodInfo mi("char", PropertyInfo(Variant::INT, "ascii"));
|
MethodInfo mi("char", PropertyInfo(Variant::INT, "code"));
|
||||||
mi.return_val.type = Variant::STRING;
|
mi.return_val.type = Variant::STRING;
|
||||||
return mi;
|
return mi;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue