sol2 icon indicating copy to clipboard operation
sol2 copied to clipboard

sol::protected_function It won't take over the exception

Open 0xdddddddd opened this issue 7 months ago • 0 comments

try
{
    sol::state& lua = *sol;

    sol::protected_function func = lua["xxxxxxxxx"];
    if (!func.valid() || !func.is<sol::protected_function>())
    {
        return false;
    }

    sol::protected_function_result result = func.call();
	return result;
}
catch (const sol::error& ex)
{
    
}

can't take over exceptions, because an exception in it returns to the following exception module

try
{
    lua.script();
}
catch (const sol::error& ex)
{
    
}

0xdddddddd avatar Apr 27 '25 21:04 0xdddddddd