-
-
Notifications
You must be signed in to change notification settings - Fork 237
Open
Labels
c: registerRegister classes, functions and other symbols to GDScriptRegister classes, functions and other symbols to GDScriptfeatureAdds functionality to the libraryAdds functionality to the library
Description
Allow for exposing default function parameters to GDScript.
The proposed syntax would look like:
#[godot_api]
impl MyType {
#[func(defaults = [ 1 ]]
fn some_func(a: Option<i32>) -> i32 {
a.unwrap_or(1)
}
}
This would map roughly to this in C++:
ClassDB::bind_method(D_METHOD("some_func", "a"), &MyType::some_func, DEFVAL(1));
Ideally the macro would also allow for function calls from Godot to automatically insert the default parameters as well so that Option<T>
is not required, but I'm not sure if that's feasible.
WIP in #380
Metadata
Metadata
Assignees
Labels
c: registerRegister classes, functions and other symbols to GDScriptRegister classes, functions and other symbols to GDScriptfeatureAdds functionality to the libraryAdds functionality to the library