sol2
sol2 copied to clipboard
How to eliminate the C Closure created during usertype construction
//c++
module.new_usertype<Vector3>(
"Vector3",
sol::constructors<Vector3(float, float, float)>(),
"add",
&Vector3::add,
...);
//lua
local pos = Vector3.new(0, 0, 0)
I noticed that when constructing a Vector3 in Lua, it creates a C closure to build the Vector userdata. May I ask how I can avoid creating this closure? Because it impacts performance and additionally creates a GC object for the C closure.