I have some integration with Lua in my project, and for some class instances (like TStringList, TComponent, TFileStream, TBitmap etc...) I create a lua object that describes the class instance. (that way the user can access published properties and some exposed methods)
Now I want to unreference that lua object when my class instance is destroyed.
I could probably easily add a luaref:integer field to TObject and override it's destructor , recompile freepascal and be done with it (no idea if that would even work) but I am trying to keep the compilation of my project as straighforward as possible for other people that also wish to compile it.
any ideas ?
(and yes, I know I could give lua inherited classes instead of the actual ones, but the user has access to the raw GUI and it's properties. They can enumerate all controls and components and access those like normal objects as well. I don't really want to change my whole gui to all derived class objects just for a little bit of easier maintenance)