godotengine / godotengine/godot-headers

Default arguments in signals

Open
#88 2 comments 2 reactions 0 assignees View on GitHub
bug
Dominant language
C
Stars
407
Forks
98
PR merge metrics
No merged PRs in 30d

Description

There are [`default_args`](https://github.com/godotengine/godot-headers/blob/4bae481fc305639a076a69485bed37679149bd32/nativescript/godot_nativescript.h#L186), [`num_default_args`](https://github.com/godotengine/godot-headers/blob/4bae481fc305639a076a69485bed37679149bd32/nativescript/godot_nativescript.h#L185) in `godot_signal` and [`default_value`](https://github.com/godotengine/godot-headers/blob/4bae481fc305639a076a69485bed37679149bd32/nativescript/godot_nativescript.h#L178) in `godot_signal_argument`.

Based on source code for [`godot_nativescript_register_signal`](https://github.com/godotengine/godot/blob/c7b97f077a0f62d9e280adbddddc901f35e4f40f/modules/gdnative/nativescript/godot_nativescript.cpp#L162) (link to master, there are no changes to relevant part in question since third version) seems like `default_args` are not used. Instead a number of `num_default_args` `default_value`s is [collected](https://github.com/godotengine/godot/blob/c7b97f077a0f62d9e280adbddddc901f35e4f40f/modules/gdnative/nativescript/godot_nativescript.cpp#L187) from the start of args for use as defaults.

So seems like either `default_args` or `default_value` should be removed.

It seems wrong that default values are collected from the start and not the end of `args`.

And [`usage`](https://github.com/godotengine/godot-headers/blob/4bae481fc305639a076a69485bed37679149bd32/nativescript/godot_nativescript.h#L177) property in `godot_signal_argument` seems meaningless (it is absent from [`godot_method_arg`](https://github.com/godotengine/godot-headers/blob/4bae481fc305639a076a69485bed37679149bd32/nativescript/godot_nativescript.h#L209) for example).

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.