godotengine / godotengine/godot-docs

Add a disclaimer of [Object].get_method_list() limitations with non builtin types.

Open
#7,047 0 comments 0 reactions 0 assignees View on GitHub
area:class reference enhancement
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**Your Godot version:**
4.0-stable
**Issue description:**
When you use the [Object].get_method_list()and start inspecting the dictionary properties, it's not clear which properties exist for built in types only. For example I assumed that this code would print true:
```
@tool
extends EditorScript

func _run():
assert(has_method("foo"))
for method in get_method_list():
if method["name"] == "foo":
print(method["return"]["type"]==TYPE_STRING)

func foo()->String:
return "bar"

```

It may very well be a bug with godot, but I think it is more likely that the compiler simply isn't capable of detecting this case yet(Maybe something that should be added as a feature request??). But if this is a bug and not something that is missing to the documentation, I'll submit a bug report instead.
**URL to the documentation page (if already existing):**
https://docs.godotengine.org/en/stable/classes/class_object.html#class-object-method-get-method-list

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.