From ca293c723f78b22ebf99a2feda995c02fb5be430 Mon Sep 17 00:00:00 2001 From: ThePhD Date: Sun, 26 May 2019 15:44:38 -0400 Subject: [PATCH] add sol::stack::get_traceback convenience function --- include/sol/state_handling.hpp | 9 +++++++++ single/include/sol/forward.hpp | 4 ++-- single/include/sol/sol.hpp | 12 ++++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/include/sol/state_handling.hpp b/include/sol/state_handling.hpp index 8484e6c0..ab42ceaa 100644 --- a/include/sol/state_handling.hpp +++ b/include/sol/state_handling.hpp @@ -26,6 +26,7 @@ #include "trampoline.hpp" #include "stack.hpp" +#include "error.hpp" #include "function.hpp" #include "object.hpp" #include "lua_value.hpp" @@ -177,6 +178,14 @@ namespace sol { return script_throw_on_error(L, std::move(pfr)); #endif } + + namespace stack { + inline error get_traceback_or_errors(lua_State* L) { + int p = default_traceback_error_handler(L); + sol::error err = stack::get(L, -p); + return std::move(err); + } + } } // namespace sol #endif // SOL_STATE_DEFAULT_HPP diff --git a/single/include/sol/forward.hpp b/single/include/sol/forward.hpp index 2c0f93d5..96db7277 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 2019-05-26 17:50:22.004134 UTC -// This header was generated with sol v3.0.2 (revision a49fbc2) +// Generated 2019-05-26 19:43:41.438672 UTC +// This header was generated with sol v3.0.2 (revision fe5c71e) // 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 e56f714b..6b00b9be 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 2019-05-26 17:50:20.845211 UTC -// This header was generated with sol v3.0.2 (revision a49fbc2) +// Generated 2019-05-26 19:43:41.120525 UTC +// This header was generated with sol v3.0.2 (revision fe5c71e) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_HPP @@ -23980,6 +23980,14 @@ namespace sol { return script_throw_on_error(L, std::move(pfr)); #endif } + + namespace stack { + inline error get_traceback_or_errors(lua_State* L) { + int p = default_traceback_error_handler(L); + sol::error err = stack::get(L, -p); + return std::move(err); + } + } } // namespace sol // end of sol/state_handling.hpp