Skip to content

Add abstraction for ScriptInstanceExtension  #196

Description

@lilizoey

When creating a language extension for godot, you need to create instances of your scripts. These are the actual objects that will run the code that your scripts define. For performance reasons, these are not normal godot classes, but instead a pointer to the instance and a vtable (struct of function pointers).

This means that if you want to use/create these instances, you currently need to do a lot of manual pointer casting and ffi-stuff. Generally through the method script_instance_create and using the GDExtensionScriptInstanceInfo struct directly.

Ideally there would be some abstraction, probably a trait or something that will let you easily create the instance, and a trait for the GDExtensionScriptInstanceInfo struct, as it is effectively just an interface for what methods are supported.

Another issue is that this is almost entirely undocumented, as there is no godot documentation page (that i could find) that talks about this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: engineGodot classes (nodes, resources, ...)c: script-instanceScript-instance APIsfeatureAdds functionality to the library

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions