Skip to content

GDExtension missing CallableCustom class and methods #79065

Closed
@Trey2k

Description

@Trey2k

Godot version

4.x

System information

N/A

Issue description

Currently GDExtension does not have access to the CallableCustom type at all. We can test if a Callable is custom but that's about it. This has become an issue for a addon I maintain that supports building as a module and GDExtension. The addon adds access to the luaAPI for godot. Before adding support for GDExtension when Lua tried to pass a function to GD we would create a Lua func ref and had a CallableCustom class which took that and invoked the Lua func ref in the call method. Creating a Lua func ref makes a copy of the method that must be cleaned up, so we would do that in the deconstructor.

However, when adding GDExtension support I found we don't get access to this class at all. The workaround I used was to expose a method to the class DB that took an array of args and the func ref, when Lua passed a function to GD we would return the Callable with the func ref bound.

There is 2 major issues with this workaround. It forces us to take the arguments as an array instead of being able to take any number. And the bigger issue IMO we do not have a deconstructor meaning I have no way of cleaning up the func ref.

Along with the missing class, Callable itself is also missing methods. We have is_custom(), but are notably missing get_custom(). I assume this is since the class isn't even exposed.

Steps to reproduce

  • Generate the extension_api.json and gdextension_interace.h files with: godot --dump-extension-api --dump-gdextension-interface
  • Search for CallableCustom in these files.

Minimal reproduction project

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions