godotengine / godotengine/godot-cpp

Variant::has_method bug

Open
#1,120 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.7k
Forks
809
Avg merge
1d 3h
Merged PRs (30d)
8

Description

Currently if you pass a Variant to variant's has_method function it will always report false. but if you cast it to a String() before hand it works.

Example of issue:
```cpp
void Class::test(Variant var)
{
Variant method = "floor";
UtilityFunctions::print(var.has_method(method));
UtilityFunctions::print(var.has_method(method.operator String()));
}
```
The output will be:
```
false
true
```

When compiling as a module however this works as expected.

godot-cpp version: 7fb46e9

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.