You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As per the docs we can assign a function directly to a property setter:
varmy_prop:=1.0:
set=my_setter
Also the docs suggest that this can be used to "share the code across multiple properties". However this does not work with currying and lambda functions (see example in Steps to reproduce).
The reported error is:
Parse Error: Expected end of statement after property declaration, found "(" instead.
Also the docs suggest that this can be used to "share the code across multiple properties".
The sentence in the docs is a bit confusing. At the moment, you can share the same setter/getter between multiple properties, but have no way of distinguishing which property it's being called on. See:
Binding arbitrary arguments sounds useful, but it's probably complex to implement. Functions are not Callables, they just create Callables at runtime when referenced. So to properly call the setter/getter with binds those would need to be stored in the script and passed as arguments at runtime. If you want non-constant values it becomes more difficult because it would need to store expressions to be executed when calling. I don't think this is worth the hassle.
I suggest closing the issue, as this is not a bug, but an intentional limitation for performance reasons. There are already several proposals related to the problem.
Godot version
v4.0.beta9.official [e780dc3]
System information
Windows 11
Issue description
As per the docs we can assign a function directly to a property setter:
Also the docs suggest that this can be used to "share the code across multiple properties". However this does not work with currying and lambda functions (see example in Steps to reproduce).
The reported error is:
Steps to reproduce
Example code with the issue:
Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered: