Remove @GDScript.str
(duplicate of @GlobalScope.str
)
This commit is contained in:
parent
833c0d24db
commit
be4f36b87e
3 changed files with 7 additions and 36 deletions
|
@ -1271,7 +1271,13 @@
|
||||||
<method name="str" qualifiers="vararg">
|
<method name="str" qualifiers="vararg">
|
||||||
<return type="String" />
|
<return type="String" />
|
||||||
<description>
|
<description>
|
||||||
Converts one or more arguments of any [Variant] type to [String] in the best way possible.
|
Converts one or more arguments of any [Variant] type to a [String] in the best way possible.
|
||||||
|
[codeblock]
|
||||||
|
var a = [10, 20, 30]
|
||||||
|
var b = str(a)
|
||||||
|
print(len(a)) # Prints 3 (the number of elements in the array).
|
||||||
|
print(len(b)) # Prints 12 (the length of the string "[10, 20, 30]").
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="str_to_var">
|
<method name="str_to_var">
|
||||||
|
|
|
@ -227,18 +227,6 @@
|
||||||
[/codeblock]
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="str" qualifiers="vararg">
|
|
||||||
<return type="String" />
|
|
||||||
<description>
|
|
||||||
Converts one or more arguments to a [String] in the best way possible.
|
|
||||||
[codeblock]
|
|
||||||
var a = [10, 20, 30]
|
|
||||||
var b = str(a);
|
|
||||||
len(a) # Returns 3
|
|
||||||
len(b) # Returns 12
|
|
||||||
[/codeblock]
|
|
||||||
</description>
|
|
||||||
</method>
|
|
||||||
<method name="type_exists">
|
<method name="type_exists">
|
||||||
<return type="bool" />
|
<return type="bool" />
|
||||||
<param index="0" name="type" type="StringName" />
|
<param index="0" name="type" type="StringName" />
|
||||||
|
|
|
@ -112,28 +112,6 @@ struct GDScriptUtilityFunctionsDefinitions {
|
||||||
*r_ret = String(result);
|
*r_ret = String(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void str(Variant *r_ret, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {
|
|
||||||
if (p_arg_count < 1) {
|
|
||||||
r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
|
|
||||||
r_error.argument = 1;
|
|
||||||
r_error.expected = 1;
|
|
||||||
*r_ret = Variant();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String str;
|
|
||||||
for (int i = 0; i < p_arg_count; i++) {
|
|
||||||
String os = p_args[i]->operator String();
|
|
||||||
|
|
||||||
if (i == 0) {
|
|
||||||
str = os;
|
|
||||||
} else {
|
|
||||||
str += os;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*r_ret = str;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void range(Variant *r_ret, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {
|
static inline void range(Variant *r_ret, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {
|
||||||
switch (p_arg_count) {
|
switch (p_arg_count) {
|
||||||
case 0: {
|
case 0: {
|
||||||
|
@ -651,7 +629,6 @@ void GDScriptUtilityFunctions::register_functions() {
|
||||||
REGISTER_VARIANT_FUNC(convert, true, VARARG("what"), ARG("type", Variant::INT));
|
REGISTER_VARIANT_FUNC(convert, true, VARARG("what"), ARG("type", Variant::INT));
|
||||||
REGISTER_FUNC(type_exists, true, Variant::BOOL, ARG("type", Variant::STRING_NAME));
|
REGISTER_FUNC(type_exists, true, Variant::BOOL, ARG("type", Variant::STRING_NAME));
|
||||||
REGISTER_FUNC(_char, true, Variant::STRING, ARG("char", Variant::INT));
|
REGISTER_FUNC(_char, true, Variant::STRING, ARG("char", Variant::INT));
|
||||||
REGISTER_VARARG_FUNC(str, true, Variant::STRING);
|
|
||||||
REGISTER_VARARG_FUNC(range, false, Variant::ARRAY);
|
REGISTER_VARARG_FUNC(range, false, Variant::ARRAY);
|
||||||
REGISTER_CLASS_FUNC(load, false, "Resource", ARG("path", Variant::STRING));
|
REGISTER_CLASS_FUNC(load, false, "Resource", ARG("path", Variant::STRING));
|
||||||
REGISTER_FUNC(inst_to_dict, false, Variant::DICTIONARY, ARG("instance", Variant::OBJECT));
|
REGISTER_FUNC(inst_to_dict, false, Variant::DICTIONARY, ARG("instance", Variant::OBJECT));
|
||||||
|
|
Loading…
Reference in a new issue