mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
usertype destructor needs to be of the right type for non-const values
This commit is contained in:
parent
72b9d91c14
commit
015ef6a37a
|
@ -191,7 +191,7 @@ namespace sol {
|
|||
return &detail::unique_destruct<T>;
|
||||
}
|
||||
else if constexpr (!std::is_pointer_v<T>) {
|
||||
return &detail::unique_destruct<T>;
|
||||
return &detail::usertype_alloc_destruct<T>;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -274,15 +274,15 @@ namespace sol {
|
|||
|
||||
void operator()() const {
|
||||
if (luaL_newmetatable(L, key) == 1) {
|
||||
luaL_Reg l[64]{};
|
||||
luaL_Reg l[64] {};
|
||||
int index = 0;
|
||||
auto prop_fx = [](meta_function) { return true; };
|
||||
auto insert_fx = [&l, &index](meta_function mf, lua_CFunction f) {
|
||||
l[index] = luaL_Reg{ to_string(mf).c_str(), f };
|
||||
l[index] = luaL_Reg { to_string(mf).c_str(), f };
|
||||
++index;
|
||||
};
|
||||
u_detail::insert_default_registrations<P>(insert_fx, prop_fx);
|
||||
l[index] = luaL_Reg{ to_string(meta_function::garbage_collect).c_str(), u_detail::make_destructor<P>() };
|
||||
l[index] = luaL_Reg { to_string(meta_function::garbage_collect).c_str(), u_detail::make_destructor<P>() };
|
||||
luaL_setfuncs(L, l, 0);
|
||||
|
||||
// __type table
|
||||
|
|
Loading…
Reference in New Issue
Block a user