add sol::stack::get_traceback convenience function

This commit is contained in:
ThePhD 2019-05-26 15:44:38 -04:00
parent fe5c71e792
commit ca293c723f
No known key found for this signature in database
GPG Key ID: 1509DB1C0F702BFA
3 changed files with 21 additions and 4 deletions

View File

@ -26,6 +26,7 @@
#include "trampoline.hpp" #include "trampoline.hpp"
#include "stack.hpp" #include "stack.hpp"
#include "error.hpp"
#include "function.hpp" #include "function.hpp"
#include "object.hpp" #include "object.hpp"
#include "lua_value.hpp" #include "lua_value.hpp"
@ -177,6 +178,14 @@ namespace sol {
return script_throw_on_error(L, std::move(pfr)); return script_throw_on_error(L, std::move(pfr));
#endif #endif
} }
namespace stack {
inline error get_traceback_or_errors(lua_State* L) {
int p = default_traceback_error_handler(L);
sol::error err = stack::get<sol::error>(L, -p);
return std::move(err);
}
}
} // namespace sol } // namespace sol
#endif // SOL_STATE_DEFAULT_HPP #endif // SOL_STATE_DEFAULT_HPP

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script. // This file was generated with a script.
// Generated 2019-05-26 17:50:22.004134 UTC // Generated 2019-05-26 19:43:41.438672 UTC
// This header was generated with sol v3.0.2 (revision a49fbc2) // This header was generated with sol v3.0.2 (revision fe5c71e)
// https://github.com/ThePhD/sol2 // https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP #ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script. // This file was generated with a script.
// Generated 2019-05-26 17:50:20.845211 UTC // Generated 2019-05-26 19:43:41.120525 UTC
// This header was generated with sol v3.0.2 (revision a49fbc2) // This header was generated with sol v3.0.2 (revision fe5c71e)
// https://github.com/ThePhD/sol2 // https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_HPP #ifndef SOL_SINGLE_INCLUDE_HPP
@ -23980,6 +23980,14 @@ namespace sol {
return script_throw_on_error(L, std::move(pfr)); return script_throw_on_error(L, std::move(pfr));
#endif #endif
} }
namespace stack {
inline error get_traceback_or_errors(lua_State* L) {
int p = default_traceback_error_handler(L);
sol::error err = stack::get<sol::error>(L, -p);
return std::move(err);
}
}
} // namespace sol } // namespace sol
// end of sol/state_handling.hpp // end of sol/state_handling.hpp