diff --git a/examples/interop/tolua/source/tolua.cpp b/examples/interop/tolua/source/tolua.cpp index 9555d54a..0c31eee1 100644 --- a/examples/interop/tolua/source/tolua.cpp +++ b/examples/interop/tolua/source/tolua.cpp @@ -29,8 +29,16 @@ inline bool sol_lua_interop_check(sol::types, lua_State* L, int relindex, sol (void)handler; int index = lua_absindex(L, relindex); std::string name = sol::detail::short_demangle(); - tolua_Error tolua_err; - return tolua_isusertype(L, index, name.c_str(), 0, &tolua_err); + tolua_Error tolua_err{}; + int r = tolua_isusertype(L, index, name.c_str(), 0, &tolua_err); + if (r == 0) { + // tolua seems to leave garbage on the stack + // when the check fails + // thanks, tolua + lua_pop(L, 2); + return false; + } + return true; } void register_sol_stuff(lua_State* L) { diff --git a/include/sol/base_traits.hpp b/include/sol/base_traits.hpp index 4056b203..712c8b9b 100644 --- a/include/sol/base_traits.hpp +++ b/include/sol/base_traits.hpp @@ -39,7 +39,16 @@ namespace sol { template using void_t = void; + template + using unqualified = std::remove_cv>; + + template + using unqualified_t = typename unqualified::type; + namespace meta_detail { + template + struct unqualified_non_alias : unqualified {}; + template