-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
I'm currently working with Raylib which is written in C. It relies on the developer to manually unload resources.
In the example of Texture2d, I would like to define __gc to clean it up automatically when used from Lua, but the reference to the userdata object gets lost.
Example:
luaTexture2d.def("__gc", [](Texture2d& self){ unloadTexture(self);});
__gc is not called in this case unless no arguments are passed.
Unless I'm missing something. I would have to add a GC function to the struct and then bind it that way, but this would break on upstream updates.
I also tried adding the destructor through the .ctor function but this throws a type error.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels