diff --git a/include/sol/stack_check_unqualified.hpp b/include/sol/stack_check_unqualified.hpp index 8bfe0908..b80297cc 100644 --- a/include/sol/stack_check_unqualified.hpp +++ b/include/sol/stack_check_unqualified.hpp @@ -38,9 +38,7 @@ namespace sol { namespace stack { namespace stack_detail { - template - inline bool check_metatable(lua_State* L, int index = -2) { - const auto& metakey = usertype_traits::metatable(); + inline bool impl_check_metatable(lua_State* L, int index, const std::string& metakey, bool poptable) { luaL_getmetatable(L, &metakey[0]); const type expectedmetatabletype = static_cast(lua_type(L, -1)); if (expectedmetatabletype != type::lua_nil) { @@ -53,6 +51,11 @@ namespace sol { namespace stack { return false; } + template + inline bool check_metatable(lua_State* L, int index = -2) { + return impl_check_metatable(L, index, usertype_traits::metatable(), poptable); + } + template struct basic_check { template diff --git a/include/sol/trampoline.hpp b/include/sol/trampoline.hpp index d0cdad1d..6c685529 100644 --- a/include/sol/trampoline.hpp +++ b/include/sol/trampoline.hpp @@ -99,8 +99,8 @@ namespace sol { return trampoline(L, f); } #else - template - int static_trampoline(lua_State* L) { + + inline int impl_static_trampoline(lua_State* L, lua_CFunction f) { #if defined(SOL_EXCEPTIONS_SAFE_PROPAGATION) && !defined(SOL_LUAJIT) return f(L); @@ -119,7 +119,7 @@ namespace sol { } #if !defined(SOL_EXCEPTIONS_SAFE_PROPAGATION) // LuaJIT cannot have the catchall when the safe propagation is on - // but LuaJIT will swallow all C++ errors + // but LuaJIT will swallow all C++ errors // if we don't at least catch std::exception ones catch (...) { call_exception_handler(L, optional(nullopt), "caught (...) exception"); @@ -129,6 +129,11 @@ namespace sol { #endif // Safe exceptions } + template + int static_trampoline(lua_State* L) { + return impl_static_trampoline(L, f); + } + #ifdef SOL_NOEXCEPT_FUNCTION_TYPE #if 0 // impossible: g++/clang++ choke as they think this function is ambiguous: diff --git a/single/include/sol/forward.hpp b/single/include/sol/forward.hpp index ba62369b..9172a1d2 100644 --- a/single/include/sol/forward.hpp +++ b/single/include/sol/forward.hpp @@ -20,8 +20,8 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // This file was generated with a script. -// Generated 2020-06-18 22:17:10.413702 UTC -// This header was generated with sol v3.2.1 (revision 162fdd74) +// Generated 2020-06-20 04:08:19.579717 UTC +// This header was generated with sol v3.2.1 (revision 5e40ef09) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP diff --git a/single/include/sol/sol.hpp b/single/include/sol/sol.hpp index 10285963..dbf2658b 100644 --- a/single/include/sol/sol.hpp +++ b/single/include/sol/sol.hpp @@ -20,8 +20,8 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // This file was generated with a script. -// Generated 2020-06-18 22:17:10.286043 UTC -// This header was generated with sol v3.2.1 (revision 162fdd74) +// Generated 2020-06-20 04:08:19.416569 UTC +// This header was generated with sol v3.2.1 (revision 5e40ef09) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_HPP @@ -7476,8 +7476,8 @@ namespace sol { return trampoline(L, f); } #else - template - int static_trampoline(lua_State* L) { + + inline int impl_static_trampoline(lua_State* L, lua_CFunction f) { #if defined(SOL_EXCEPTIONS_SAFE_PROPAGATION) && !defined(SOL_LUAJIT) return f(L); @@ -7496,7 +7496,7 @@ namespace sol { } #if !defined(SOL_EXCEPTIONS_SAFE_PROPAGATION) // LuaJIT cannot have the catchall when the safe propagation is on - // but LuaJIT will swallow all C++ errors + // but LuaJIT will swallow all C++ errors // if we don't at least catch std::exception ones catch (...) { call_exception_handler(L, optional(nullopt), "caught (...) exception"); @@ -7506,6 +7506,11 @@ namespace sol { #endif // Safe exceptions } + template + int static_trampoline(lua_State* L) { + return impl_static_trampoline(L, f); + } + #ifdef SOL_NOEXCEPT_FUNCTION_TYPE #if 0 // impossible: g++/clang++ choke as they think this function is ambiguous: @@ -10671,9 +10676,7 @@ namespace sol { namespace sol { namespace stack { namespace stack_detail { - template - inline bool check_metatable(lua_State* L, int index = -2) { - const auto& metakey = usertype_traits::metatable(); + inline bool impl_check_metatable(lua_State* L, int index, const std::string& metakey, bool poptable) { luaL_getmetatable(L, &metakey[0]); const type expectedmetatabletype = static_cast(lua_type(L, -1)); if (expectedmetatabletype != type::lua_nil) { @@ -10686,6 +10689,11 @@ namespace sol { namespace stack { return false; } + template + inline bool check_metatable(lua_State* L, int index = -2) { + return impl_check_metatable(L, index, usertype_traits::metatable(), poptable); + } + template struct basic_check { template