Open RDaac opened 3 months ago
Using the exact type should work:
int sol_lua_push(sol::types<MyStruct>, lua_State *L, const MyStruct &v) {
// Recurses here instead of calling lua_pushboolean(L, v.value)
int amount = sol::stack::push<bool>(L, v.value);
return amount;
}
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):