-
-
Notifications
You must be signed in to change notification settings - Fork 22.1k
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
Core: Bind and document iterator API virtual methods #89649
Core: Bind and document iterator API virtual methods #89649
Conversation
|
||
// These are actually `Variant` methods, but that doesn't matter since scripts can't inherit built-in types. | ||
|
||
BIND_OBJ_CORE_METHOD(MethodInfo(Variant::BOOL, "_iter_init", PropertyInfo(Variant::ARRAY, "iter"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name iter
comes from here. I was thinking about binding this as state
, but not sure.
Lines 728 to 730 in fe01776
bool iter_init(Variant &r_iter, bool &r_valid) const; | |
bool iter_next(Variant &r_iter, bool &r_valid) const; | |
Variant iter_get(const Variant &r_iter, bool &r_valid) const; |
8bcb25d
to
8aa0533
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documentation looks good to me.
8aa0533
to
be5068d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope @dalexeev knows the documentation part is fine by me, too.
Since in my opinion this is a simple, small, but useful addition and since there are two approvals, I moved milestone to 4.4. |
Thanks! |
This is documented here, but I think it's not enough. This is one of Godot's secret features. Binding and documentation facilitates better discoverability, autocompletion, and static checks. See also #89639, the bug still exists only because it is not obvious that the
_iter_get()
argument does not haveArray
wrapper, unlike_iter_init()
and_iter_next()
.