diff options
author | Haoyu Qiu <timothyqiu32@gmail.com> | 2019-12-15 11:10:29 +0800 |
---|---|---|
committer | Haoyu Qiu <timothyqiu32@gmail.com> | 2019-12-15 19:06:29 +0800 |
commit | 468fcd80bbb9b7c2928641ef0a7fdd94b0d7d54f (patch) | |
tree | 2c21ff67a11951ef8221087ca8f96befbf5c329e /modules/gdscript/doc_classes | |
parent | ce7d3bb1c7a4d146c1afaef7d1cde414162d4d02 (diff) |
Updates docs for GDScript built-in functions
* Adds description for `ord()`
* Adds relationship description between `char()` and `ord()`
* Describes the argument of `char()` as Unicode code point instead of ASCII code
* Fixes wrong interval notation in `randi()` description
Diffstat (limited to 'modules/gdscript/doc_classes')
-rw-r--r-- | modules/gdscript/doc_classes/@GDScript.xml | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml index 502a68cd61..e84f84d788 100644 --- a/modules/gdscript/doc_classes/@GDScript.xml +++ b/modules/gdscript/doc_classes/@GDScript.xml @@ -168,14 +168,16 @@ <method name="char"> <return type="String"> </return> - <argument index="0" name="ascii" type="int"> + <argument index="0" name="code" type="int"> </argument> <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] a = char(65) # a is "A" a = char(65 + 32) # a is "a" + a = char(8364) # a is "€" [/codeblock] + This is the inverse of [method ord]. </description> </method> <method name="clamp"> @@ -702,6 +704,13 @@ <argument index="0" name="char" type="String"> </argument> <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> </method> <method name="parse_json"> @@ -937,7 +946,7 @@ <return type="int"> </return> <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] randi() # Returns random integer between 0 and 2^32 - 1 randi() % 20 # Returns random integer between 0 and 19 |