-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get Function Argument Type(s) #3614
Comments
so, in total all i need is:
|
Such ability already exists via extends Node2D
func _ready():
for method in get_script().get_script_method_list():
if method.name == "clear":
print(method.args)
assert(method.args[0].type == TYPE_COLOR)
func clear(bg: Color):
pass However, this doesn't seem to provide proper information about method signatures ("bg" variable is empty), may be a bug. But this properly returns the type. Note that when you print the entire array, it may not print the info properly for some reason, which may be a bug in data representation (which requires evaluating/stringifying nested data structures recursively). Works in Godot 3.x for me. |
i used to use get_method_list() |
this worked so far |
Yeah, |
This comment has been minimized.
This comment has been minimized.
In cases like this you can infer the required number of args But looks like |
This comment has been minimized.
This comment has been minimized.
Expected, because For the record, it wasn't me who marked your previous message as off-topic. |
that was me, trying to keep this clean, yet my problems solved |
Invalid index 'type' (on base: 'String') |
As discussed above, this already exists, but is bugged. |
Describe the project you are working on
Console where you can call functions from ingame
Describe the problem or limitation you are having in your project
i need to get the argument types
preferably without creating an array and hardcoding that stuff in it
Describe the feature / enhancement and how it helps to overcome the problem or limitation
can't do that know (as far as i know)
would be happy for this, so i wouldn't have to hardcode that in some array
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
If this enhancement will not be used often, can it be worked around with a few lines of script?
not as far as i know
other than some shiddy spereate array
Is there a reason why this should be core and not an add-on in the asset library?
no other way of doing it as far as i know
without extra manual work every time i add/modify a function
The text was updated successfully, but these errors were encountered: