Hey, I have a C++ class instance that is passed to Lua as userdata wrapped by SWIG. It has the typical metatable constructed by SWIG, but I want to adjust this one type to be able to modify it from Lua. I am not sure how this is done (__index/__newindex functions, don't really know). Could you please tell me if there is a SWIG directive that I can use to accomplish this. If not, what is the most tactful way to make such changes while continuing to use SWIG?

Also, my project is set to rebuild SWIG wrappers preceding each build iteration. I want to avoid modifying the generated C++ wrappers directly because I would need to make these changes manually again and again with each iteration or any binding code change.

Any help is appreciated!