How to expose C++ data (a vector, in this case) to Lua without making a copy?
Hi there, I'm learning and experimenting with LuaBridge, and have exposed a test Object class and have created a std::vector<Object> in C++. I want to expose this vector (table) of data to Lua, but without it being a copy. So, for example, if I insert a new entry to the table via Lua (table.insert(test.objs, Object())), I'd like that change to be reflected back in the C++ vector. Likewise, I'd like modifications to the elements of the vector (in C++) to be reflected when accessed later in Lua.
Currently, my attempts to do (including specifying the std::vector<Object> instance as a pointer or reference) this have only resulted in copies of the vector being made available in Lua. (that is to say, a copy is made at the moment of adding the variable to Lua)
Is it even possible to do what I want with LuaBridge? Thanks.
Refer to this discussion https://github.com/kunitoki/LuaBridge3/discussions/176
Thanks, added a comment there!