I want to add some static fields to my Lua userdata objects coming from C++. The objects in question are vectors, they're created in C++ land and they work as they are but I've tried lua_setfield
on my userdata but I get a attempt to index a Vector value
error and I don't really want to have to use .x(), .y(), .z()
due to the cost of having to call a function, push to stack and then read on the Lua side.
Is there any way to register fields on userdata for Lua access?