You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working with a library that has a variant class with non-explicit constructors for basic types like Variant(bool) and Variant(const char *). After adding sol3 sol_lua_get/push/check() functions for this type, sol operations on basic types, like lua["value"] = "cstring" or sol::stack::push<bool>(boolValue), will favor implicitly converting to the variant type and calling the custom sol_lua_push function over using the built-in operations for the basic types.
Is there a solution or fix for this? The equivalent sol2 implementation using struct pusher worked as expected.
This example recurses and segfaults (g++14, sol 3):
#include<sol.hpp>structMyStruct {
MyStruct(bool val) { value = val; } // not marked explicitbool value;
};
intsol_lua_push(lua_State *L, const MyStruct &v)
{
// Recurses here instead of calling lua_pushboolean(L, v.value)
sol::stack::push<bool>(L, v.value);
return1;
}
intmain()
{
sol::state lua;
// Resolves to sol_lua_push(L, MyStruct(true)) instead of lua_pushboolean(L, true),
lua["value"] = true;
return0;
}
The text was updated successfully, but these errors were encountered:
I'm working with a library that has a variant class with non-explicit constructors for basic types like
Variant(bool)
andVariant(const char *)
. After adding sol3sol_lua_get/push/check()
functions for this type,sol
operations on basic types, likelua["value"] = "cstring"
orsol::stack::push<bool>(boolValue)
, will favor implicitly converting to the variant type and calling the customsol_lua_push
function over using the built-in operations for the basic types.Is there a solution or fix for this? The equivalent sol2 implementation using
struct pusher
worked as expected.This example recurses and segfaults (g++14, sol 3):
The text was updated successfully, but these errors were encountered: